You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
snapd-extra-utils/debian/tests/snapd-seed-glue

41 lines
1.2 KiB

#!/bin/bash
set -e
# File to track command output, so we can check for successful completion
OUTPUT_FILE=$(mktemp)
# If the command output does not contain a final confirmation of success, exit 1
confirm_success () {
if grep -q "Cleanup and validation completed" "$OUTPUT_FILE"; then
rm -f "$OUTPUT_FILE"
else
exit 1
fi
}
# Function to run snapd-seed-glue with given arguments
run_snapd_seed_glue () {
/usr/bin/snapd-seed-glue --verbose --seed hello_test "$@" > >(tee -a "$OUTPUT_FILE") 2>&1
confirm_success
}
echo "[snapd-seed-glue autopkgtest] Testing snapd-seed-glue with hello..."
run_snapd_seed_glue hello
echo "[snapd-seed-glue autopkgtest] Add htop to the same seed..."
run_snapd_seed_glue hello htop
echo "[snapd-seed-glue autopkgtest] Remove htop and replace it with btop..."
run_snapd_seed_glue hello btop
echo "[snapd-seed-glue autopkgtest] Confirm that non-existent snaps will fail..."
/usr/bin/snapd-seed-glue --verbose --seed test_dir absolutelyridiculouslongnamethatwilldefinitelyneverexist > >(tee -a "$OUTPUT_FILE") 2>&1 || echo "Fail expected"
if ! grep -q "cannot install snap \"absolutelyridiculouslongnamethatwilldefinitelyneverexist\": snap not found" "$OUTPUT_FILE"; then
exit 1
fi