From a960454583b3119ccc3f1bbea3ecd60d83b9e0db Mon Sep 17 00:00:00 2001 From: Maciej Borzecki Date: Fri, 26 Oct 2018 18:19:06 +0200 Subject: [PATCH] tests/main/install-errors: fix error matching, fix systems not supporting classic Signed-off-by: Maciej Borzecki --- tests/main/install-errors/task.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/main/install-errors/task.yaml b/tests/main/install-errors/task.yaml index 9f71e6b0257..35865a7ee32 100644 --- a/tests/main/install-errors/task.yaml +++ b/tests/main/install-errors/task.yaml @@ -77,9 +77,16 @@ execute: | fi MATCH 'characters that look like dashes but are not' < stderr.out - echo "Installing a strict snap in classic mode does not work" - if snap install --classic test-snapd-tools 2>stderr.out; then - echo "snap install ––classic test-snapd-tools should have failed but did not" - exit 1 + #shellcheck source=tests/lib/snaps.sh + . "$TESTSLIB"/snaps.sh + #shellcheck source=tests/lib/strings.sh + . "$TESTSLIB"/strings.sh + + if is_classic_confinement_supported ; then + echo "Installing a strict snap in classic mode does not work" + if snap install --classic test-snapd-busybox-static 2>stderr.out; then + echo "snap install ––classic test-snapd-busybox-static should have failed but did not" + exit 1 + fi + str_to_one_line "$(cat stderr.out)" | MATCH 'classic confinement requested for a non classic confined snap' fi - MATCH 'classic confinment requested for a non classic confined snap' < stderr.out