Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions tests/test_shared_just.bats
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,29 @@ _calls() {
[ "${output}" = "#!/usr/bin/bash" ]
}

@test "powerwash: delegates to bctl when bctl is available" {
@test "powerwash: two confirmations run bootc install reset via sudo" {
_queue_answers "Yes - wipe this machine" "Yes - wipe this machine"

_run_powerwash with-bctl
_run_powerwash

[ "${status}" -eq 0 ]
run grep -Fq "bctl powerwash" <<< "$(_calls)"
run grep -Fqx "sudo bootc install reset --experimental" <<< "$(_calls)"
[ "${status}" -eq 0 ]
# Both confirmations were prompted before any destructive call.
[ "$(grep -c '^gum ' <<< "$(_calls)")" -eq 2 ]
}

@test "powerwash: bctl delegation skips gum prompts and sudo entirely" {
@test "powerwash: never invokes bctl even when bctl is on PATH" {
# bctl delegation was removed in #1083; the recipe owns the flow directly.
_queue_answers "Yes - wipe this machine" "Yes - wipe this machine"

_run_powerwash with-bctl

run grep -q "^gum " <<< "$(_calls)"
[ "${status}" -ne 0 ]
run grep -q "^sudo " <<< "$(_calls)"
[ "${status}" -eq 0 ]
run grep -q "^bctl " <<< "$(_calls)"
[ "${status}" -ne 0 ]
run grep -Fqx "sudo bootc install reset --experimental" <<< "$(_calls)"
[ "${status}" -eq 0 ]
}

@test "powerwash: declining the first confirmation cancels without wiping" {
Expand Down
2 changes: 2 additions & 0 deletions tests/test_ujust.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ case "$1" in
shellenv)
printf 'export PATH="%s/bin:$PATH"\n' "${MOCK_PREFIX}"
;;
bundle)
;;
*)
exit 1
;;
Expand Down
Loading