From ec98c9ce2ef9bfeae2c1b64f3c9dc8eb410bd1bd Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Sun, 24 Nov 2024 20:59:19 -0600 Subject: [PATCH] [autopkgtest] Refactor the snapd-seed-glue calls for deduplication. --- debian/changelog | 1 + debian/tests/snapd-seed-glue | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index fb31d46..858aa27 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ snapd-extra-utils (1.0.4) UNRELEASED; urgency=medium * [autopkgtest] Use snaps that are available on all arches, to fix armhf, ppc64el, and s390x failures. + * [autopkgtest] Refactor the snapd-seed-glue calls for deduplication. -- Simon Quigley Sun, 24 Nov 2024 20:55:54 -0600 diff --git a/debian/tests/snapd-seed-glue b/debian/tests/snapd-seed-glue index c0e5e43..1537ef8 100755 --- a/debian/tests/snapd-seed-glue +++ b/debian/tests/snapd-seed-glue @@ -14,22 +14,25 @@ confirm_success () { fi } -echo "Testing snapd-seed-glue with hello..." +# Function to run snapd-seed-glue with given arguments +run_snapd_seed_glue () { + /usr/bin/snapd-seed-glue --verbose --seed firefox_test "$@" > >(tee -a "$OUTPUT_FILE") 2>&1 + confirm_success +} -/usr/bin/snapd-seed-glue --verbose --seed firefox_test hello > >(tee -a "$OUTPUT_FILE") 2>&1 -confirm_success +echo "[snapd-seed-glue autopkgtest] Testing snapd-seed-glue with hello..." -echo "Add htop to the same seed..." +run_snapd_seed_glue hello -/usr/bin/snapd-seed-glue --verbose --seed firefox_test hello htop > >(tee -a "$OUTPUT_FILE") 2>&1 -confirm_success +echo "[snapd-seed-glue autopkgtest] Add htop to the same seed..." -echo "Remove htop and replace it with btop..." +run_snapd_seed_glue hello htop -/usr/bin/snapd-seed-glue --verbose --seed firefox_test hello btop > >(tee -a "$OUTPUT_FILE") 2>&1 -confirm_success +echo "[snapd-seed-glue autopkgtest] Remove htop and replace it with btop..." -echo "Confirm that non-existent snaps will fail..." +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