Validate packet capture outcomes and narrow cleanup inventory
Windows tests / test-and-build (push) Canceled after 0s

This commit is contained in:
0x000 committed 2026-09-26 21:24:03 -04:00
1 parent b9a3308214
commit 65f302279d
9 files changed
+110 -24

No files matched your search

+7 -9
View File
@@ -8,19 +8,17 @@ $script:passed=0
function Assert-Cleanup([bool]$Condition,[string]$Message){if(-not$Condition){throw $Message};$script:passed++}
try{
$files=Join-Path $scratch 'files';[IO.Directory]::CreateDirectory($files)|Out-Null
# Replace only the catalog in this module instance: all deletions stay in this test's directory.
& $module {
param($TestRoot)
$script:cleanupTestRoot=$TestRoot
function script:Get-WindPrivacyCleanupCatalog {
[pscustomobject]@{Category='Temp';Root=$script:cleanupTestRoot;Patterns=@('*');Recurse=$true}
}
} $files
# Use the production allowlist and an exact one-file plan; never scan or select other Temp files.
$tempRoot=[IO.Path]::GetFullPath([IO.Path]::GetTempPath()).TrimEnd('\')
$file=Join-Path $files 'sample.txt';$report=Join-Path $scratch 'report.json'
function New-TestCleanupPlan {
[IO.File]::WriteAllText($file,'original')
[IO.File]::SetLastWriteTimeUtc($file,[DateTime]::UtcNow.AddDays(-30))
Get-WindCleanupPlan -AgeDays 7 -Category Temp
$item=Get-Item -LiteralPath $file
[pscustomobject]@{
Schema=2;AgeDays=7;CutoffUtc=[DateTime]::UtcNow.AddDays(-7).ToString('o');Categories=@('Temp')
Files=@([pscustomobject]@{Path=$item.FullName;Root=$tempRoot;Category='Temp';Length=$item.Length;LastWriteUtc=$item.LastWriteTimeUtc.ToString('o')})
}
}
$plan=New-TestCleanupPlan