Files
WELA/tests/WecUpdate.Cli.Tests.ps1
田中ザック Isaac Mathis 610d27e8ff Review and apply query updates to existing disabled WEC subscriptions (#426)
* Add reviewed existing-only updates for disabled WEC subscriptions

* Pin loaded updater and flush locked recovery artifacts; reference PR 426

* Compare formatted WEC queries semantically before pinning raw native state

* Read native WEC subscription XML with bounded explicit Unicode pipes

* Use explicit Unicode reads for reviewed update and native cleanup

* Keep timestamp strings exact in inherited native evidence fixtures

* Reject XML-invalid descriptions before any native save

* Decode native WEC XML BOMs without unsupported Unicode switch

* Describe native XML byte decoding accurately

* Reference System.Xml explicitly when compiling under Windows PowerShell
2026-09-20 22:51:01 +09:00

16 lines
1.3 KiB
PowerShell

$ErrorActionPreference='Stop';$repo=Split-Path $PSScriptRoot -Parent
$engine=(Get-Process -Id $PID).Path;$count=0
$cases=@(
@{Args=@('wec-update','-Help');Code=0;Pattern='already disabled'},
@{Args=@('configure','-WecUpdateAction','Apply','-Auto');Code=1;Pattern='require wec-update'},
@{Args=@('wec-update','-Help','-Profile','wela-2.2.0');Code=1;Pattern='only dedicated'},
@{Args=@('wec-update','-Help','-WefAction','Configure');Code=1;Pattern='only dedicated'},
@{Args=@('wec-update','-Help','-Auto');Code=1;Pattern='only dedicated'},
@{Args=@('wec-update','-Help','-DryRun');Code=1;Pattern='only dedicated'},
@{Args=@('wec-update','-WecUpdateAction','Apply','-WecUpdateOutputPath','not-created');Code=1;Pattern='reviewed plan'},
@{Args=@('wec-update','-WecUpdateOutputPath','not-created');Code=1;Pattern='Plan requires'}
)
foreach($case in $cases){$prior=$ErrorActionPreference;try{$ErrorActionPreference='Continue';$output=@(&$engine -NoLogo -NoProfile -NonInteractive -File "$repo/WELA.ps1" @($case.Args) 2>&1);$code=$LASTEXITCODE}finally{$ErrorActionPreference=$prior};if(($case.Code -eq 0 -and $code -ne 0) -or ($case.Code -ne 0 -and $code -eq 0) -or ($output -join "`n") -notmatch $case.Pattern){throw "CLI failure: $($case.Args -join ' ') -> $code / $($output -join ' ')"};$count++}
Write-Host "WEC update CLI: $count checks passed."
$global:LASTEXITCODE=0