This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC2034
|
||||
DESCRIPTION="a failing migration stops later ones, fails the update, and runs again next time"
|
||||
IMAGE=installed
|
||||
TIER=pr
|
||||
|
||||
scenario() {
|
||||
# The first fails while ~/smoketest-block exists; the second must wait for it
|
||||
upstream_commit "Add two migrations" '
|
||||
now=$(date +%s)
|
||||
echo "[ ! -e ~/smoketest-block ] && echo first >> ~/smoketest-ran" > "migrations/$now.sh"
|
||||
echo "echo second >> ~/smoketest-ran" > "migrations/$((now + 1)).sh"'
|
||||
assert_vm "block the first migration" 'touch ~/smoketest-block'
|
||||
|
||||
cd_update
|
||||
assert_status 1
|
||||
assert_output "failed; it will run again on the next update"
|
||||
assert_output "Done, with errors in: 12-migrations.sh"
|
||||
refute_vm "neither migration ran" 'test -e ~/smoketest-ran'
|
||||
|
||||
assert_vm "unblock the first migration" 'rm ~/smoketest-block'
|
||||
cd_update
|
||||
assert_status 0
|
||||
assert_vm "both ran, in order" '[ "$(cat ~/smoketest-ran)" = "$(printf "first\nsecond")" ]'
|
||||
|
||||
cd_update
|
||||
assert_status 0
|
||||
assert_vm "neither ran again" '[ "$(wc -l < ~/smoketest-ran)" -eq 2 ]'
|
||||
}
|
||||
Reference in New Issue
Block a user