Fix run reports and Windows Home policy planning
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
942b849306
commit
22d06ac7fd
19 files changed
+72
-43
No files matched your search
@@ -70,6 +70,13 @@ $run=Invoke-MsPrivateGroupPlan -Groups $groups
|
||||
Assert-True ($run.Status-eq'PartialFailure'-and($run.Entries | Where-Object { $_.Id -eq 'First' }).Status-eq'Failed') 'Operation runner did not record a failed group.'
|
||||
Assert-True (($run.Entries | Where-Object { $_.Id -eq 'Dependent' }).Status-eq'SkippedDependency'-and$events-notcontains'dependent') 'Operation runner executed a blocked dependency.'
|
||||
Assert-True (($run.Entries | Where-Object { $_.Id -eq 'Independent' }).Status-eq'Succeeded'-and$events-contains'independent') 'Operation runner did not continue with an independent group.'
|
||||
$runReportRoot=Join-Path ([IO.Path]::GetTempPath()) ('ms-private-run-report-'+[guid]::NewGuid().ToString('N'))
|
||||
try{
|
||||
$runReportPath=Join-Path $runReportRoot 'run.json'
|
||||
$savedRun=Invoke-MsPrivateGroupPlan -Groups @([pscustomobject]@{Id='WriteReport';Label='Write report';DependsOn=@();Action={}}) -ReportPath $runReportPath
|
||||
$savedRunDisk=Get-Content -LiteralPath $runReportPath -Raw|ConvertFrom-Json
|
||||
Assert-True ($savedRun.Status-eq'Completed'-and$savedRunDisk.Status-eq'Completed'-and$savedRunDisk.Entries[0].Status-eq'Succeeded') 'Operation runner could not write and finalize a run report.'
|
||||
}finally{if(Test-Path -LiteralPath $runReportRoot){Remove-Item -LiteralPath $runReportRoot -Recurse -Force}}
|
||||
|
||||
$calls=[Collections.Generic.List[string]]::new()
|
||||
$backend=@{
|
||||
|
||||
+7
-5
@@ -45,12 +45,14 @@ function New-Plan { param($Harness,[string[]]$Ids=@('advertising-id','clipboard-
|
||||
function Apply-Test { param($Harness,$Plan) Invoke-WindTransaction -Plan $Plan -Context $Harness.Context -Store $Harness.Store -Save $Harness.Save -InstallationId 'test-installation' }
|
||||
function Restore-Test { param($Harness,$Journal) Restore-WindTransaction -Journal $Journal -Store $Harness.Store -Save $Harness.Save -InstallationId 'test-installation' }
|
||||
|
||||
Run-Test 'Home is unsupported even if a matching policy value exists' {
|
||||
Run-Test 'Home applies only explicitly documented direct registry controls' {
|
||||
$h=New-Harness; $h.Context.Edition='Core'
|
||||
$plan=New-Plan $h
|
||||
Assert-True (@($plan | Where-Object Status -NE 'Unsupported').Count -eq 0) 'Home policies must not be called enforced.'
|
||||
Assert-Throws { Apply-Test $h $plan }
|
||||
Assert-True ($h.State.Writes -eq 0 -and $h.State.Saves -eq 0) 'Unsupported apply touched state.'
|
||||
$plan=@(Get-WindPlan -Context $h.Context -Store $h.Store -Id @('advertising-id','implicit-text-collection','windows-error-reporting'))
|
||||
Assert-True (($plan|Where-Object Id -EQ 'advertising-id').Status-eq'Unsupported') 'Managed-edition policy was offered on Home.'
|
||||
$eligible=@($plan|Where-Object Status -EQ 'WouldChange')
|
||||
Assert-True ($eligible.Id-contains'implicit-text-collection'-and$eligible.Id-contains'windows-error-reporting') 'Documented direct registry controls were not offered on Home.'
|
||||
$j=Apply-Test $h $eligible
|
||||
Assert-True ($j.Status-eq'Applied'-and$h.State.Writes-eq2) 'Home direct registry controls were not applied transactionally.'
|
||||
}
|
||||
Run-Test 'Unknown build is audit-only' {
|
||||
$h=New-Harness; $h.Context.Build=99999
|
||||
|
||||
Reference in new issue
Block a user