provisioning-catalog/playbooks/bootstrap_initial/tests/dry_run.nu

28 lines
1.2 KiB
Text
Raw Normal View History

#!/usr/bin/env nu
# Validates that --dry-run produces the expected 11-step plan without executing anything.
def main []: nothing -> nothing {
let playbook_dir = $env.FILE_PWD | path join ".."
let run_script = $"($playbook_dir)/run.nu"
let r = do { ^nu $run_script --workspace "libre-wuji" --hetzner-context "test-context" --do-context "test-do-context" --bootstrap-zot-url "registry.local:5000" --s3-bucket "test-bucket" --ops-controller-key "/dev/null" --keeper-key "/dev/null" --initial-delegate-did "did:rad:test000" --ops-vm-host "ops-vm.test" --dry-run } | complete
if $r.exit_code != 0 {
print $"FAIL: dry-run exited with code ($r.exit_code)"
print $r.stderr
exit 1
}
let expected_steps = ["step 1/11", "step 2/11", "step 3/11", "step 4/11", "step 5/11", "step 6/11", "step 7/11", "step 8/11", "step 9/11", "step 10/11", "step 11/11"]
let stdout = $r.stdout
let missing = $expected_steps | where { |step| not ($stdout | str contains $step) }
if ($missing | length) > 0 {
print $"FAIL: dry-run output missing expected steps: ($missing | str join ', ')"
exit 1
}
print "PASS: bootstrap_initial --dry-run produced all 11 expected steps"
}