Validate packet capture outcomes and narrow cleanup inventory
Windows tests / test-and-build (push) Canceled after 0s
Windows tests / test-and-build (push) Canceled after 0s
This commit is contained in:
1 parent
b9a3308214
commit
65f302279d
9 files changed
+110
-24
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user