Files
coredesktop/smoketest/scenarios/31-update-replaces-itself.sh
T
david 5ed3df55e3
shellcheck / shellcheck (push) Failing after 14s
further checks
2026-11-04 10:05:50 -07:00

20 lines
749 B
Bash

#!/bin/bash
# shellcheck disable=SC2034
DESCRIPTION="a release that changes update and adds a hook: the new update and hook run in the same update"
IMAGE=installed
TIER="pr"
scenario() {
upstream_commit "Change update and add a hook" '
sed -i "s/^FAILED=()\$/echo \"smoketest: the new update ran\"\nFAILED=()/" update
grep -q "smoketest: the new update ran" update
printf "%s\n" "#!/bin/bash" "run_update() { touch ~/smoketest-hook-ran; }" > updates.d/50-smoketest.sh'
cd_update
assert_status 0
assert_output "smoketest: the new update ran"
assert_vm "the new hook ran" 'test -f ~/smoketest-hook-ran'
assert_vm "the update in ~/.local/bin is the new one" \
'cmp ~/.local/bin/update ~/.local/share/coredesktop/update'
}