Test config-only and reboot workflows
This commit is contained in:
parent
b0f78e5154
commit
0de3272d54
2
TASKS.md
2
TASKS.md
|
|
@ -86,7 +86,7 @@ Complete the core CLI and manual workflow before optional automation or a TUI.
|
|||
- [ ] Test fresh bootstrap and a second no-change apply on disposable Windows.
|
||||
- [ ] Test elevation using both the same account and separate admin credentials.
|
||||
- [x] Test paths containing spaces/non-ASCII characters and interrupted runs.
|
||||
- [ ] Test config-only updates and recovery after an installer requests a reboot.
|
||||
- [x] Test config-only updates and recovery after an installer requests a reboot.
|
||||
- [ ] Write README instructions for onboarding a machine, editing profiles,
|
||||
syncing, resolving conflicts, restoring configs, and finding logs.
|
||||
- [ ] Document supported Windows versions, limitations, and which verification
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
BeforeAll {
|
||||
foreach ($module in @('State', 'Manifest', 'Repository', 'Packages', 'Configs', 'Elevation', 'Scheduling', 'Core')) {
|
||||
Import-Module "$PSScriptRoot/../src/$module.psm1" -Force
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Core workflow policy' {
|
||||
It 'does not inventory or change packages in config-only mode' {
|
||||
InModuleScope Core -Parameters @{ Working = $TestDrive } {
|
||||
Mock Read-JsonState { @{ configs = @{} } }
|
||||
Mock Resolve-MachineManifest { [pscustomobject]@{ packages = @([pscustomobject]@{ id = 'Never.Run' }); configs = @() } }
|
||||
Mock Get-WingetInventory { throw 'WinGet must not run' }
|
||||
Mock Get-ConfigPlan { @() }
|
||||
$paths = [pscustomobject]@{ Settings = "$Working/settings.json"; State = "$Working/state.json" }
|
||||
$plan = Get-OperationPlan -Machine test -RepositoryRoot $Working -Paths $paths -ConfigsOnly
|
||||
$plan.packages.Count | Should -Be 0
|
||||
Should -Invoke Get-WingetInventory -Times 0
|
||||
}
|
||||
}
|
||||
|
||||
It 'returns the stable reboot-required exit code after successful work' {
|
||||
InModuleScope Core -Parameters @{ Working = $TestDrive } {
|
||||
Mock Invoke-PackageOperation { [pscustomobject]@{ name = 'Reboot.App'; status = 'Succeeded'; rebootRequired = $true; message = 'Installed; reboot required' } }
|
||||
$paths = Get-ConfigCentralPaths -DataRoot (Join-Path $Working 'reboot-data')
|
||||
$operation = [pscustomobject]@{
|
||||
kind = 'package'; name = 'Reboot.App'; action = 'Install'; reason = 'Missing'
|
||||
package = [pscustomobject]@{ id = 'Reboot.App'; source = 'winget'; update = 'latest' }
|
||||
}
|
||||
$plan = [pscustomobject]@{ packages = @($operation); configs = @(); state = @{ schemaVersion = 1; configs = @{} } }
|
||||
$result = Invoke-ApplyPlan -Plan $plan -Machine test -RepositoryRoot $Working -Paths $paths -Revision abc
|
||||
$result.succeeded | Should -BeTrue
|
||||
$result.exitCode | Should -Be 6
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue