Skip to content

Commit

Permalink
Merge pull request rancher-sandbox#6664 from mook-as/bats/snapshot-de…
Browse files Browse the repository at this point in the history
…lete-all-check

BATS: snapshot: ensure rdctl doesn't eat input
  • Loading branch information
jandubois authored Apr 9, 2024
2 parents e191c35 + 8a9a2e7 commit 312aeaa
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions bats/tests/helpers/snapshots.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
delete_all_snapshots() {
run rdctl snapshot list --json
assert_success
jq_output .name | while IFS= read -r name; do
run rdctl snapshot delete "$name"
assert_success
# On Windows, executing native Windows executables consumes stdin.
# https://github.com/microsoft/WSL/issues/10429
# Work around the issue by using `run` to populate `${lines[@]}` ahead of
# time, so that we don't need the buffer during the loop.
run jq_output .name
assert_success
local name
for name in "${lines[@]}"; do
rdctl snapshot delete "$name"
done
run rdctl snapshot list
assert_success
assert_output --partial 'No snapshots'
}

0 comments on commit 312aeaa

Please sign in to comment.