Files
coredesktop/smoketest/scenarios/32-new-migration.sh
T
davidandClaude Opus 5.5 101261bd9b
shellcheck / shellcheck (push) Failing after 17s
update: a failing hook without run_update fails the update
Since a65f07c ran each hook in a subshell, a hook that does its work as
it's sourced (12-migrations, 15-services, 20-aur, 30-flatpak and others)
had its failure lost: the run_update check after source left the
subshell's status at 0, so update said "Done." and exited 0. The smoketest's
40-failing-migration caught it. update now exits the subshell with the
sourced hook's status.

Also, the smoketest scenarios that check whether a migration ran look for
"Running migration " so install.sh's "Running migrations..." heading
doesn't match (11-refresh failed on it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 08:39:54 -07:00

23 lines
661 B
Bash

#!/bin/bash
# shellcheck disable=SC2034
DESCRIPTION="a release with a new migration: it runs once, and is recorded"
IMAGE=installed
TIER="pr"
scenario() {
upstream_commit "Add a migration" '
echo "echo ran >> ~/smoketest-migration" > "migrations/$(date +%s).sh"'
cd_update
assert_status 0
assert_output "Running migration "
cd_update
assert_status 0
refute_output "Running migration "
assert_vm "the migration ran exactly once" '[ "$(cat ~/smoketest-migration)" = ran ]'
assert_vm "the migration is recorded" '
cd ~/.local/share/coredesktop/migrations
for m in *.sh; do test -f ~/.local/state/coredesktop/migrations/$m; done'
}