1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
summary: Check that snap info works
details: |
This test verifies command `snap info`. Correct error messages is
expected when calling on non-existent or invalid snaps. A name,
path to snap or directory can be given as parameter. The output
should contain some correct key information.
# core18 has no python3-yaml
# amazon: no PyYAML is not packaged for python3
systems: [-amazon-*, -centos-*]
prepare: |
snap pack "$TESTSLIB"/snaps/basic
snap install test-snapd-tools
snap install --channel beta --devmode test-snapd-devmode
# ensures that an empty directory doesn't confuse things
mkdir -v core
restore: |
rmdir -v core
execute: |
echo "With no arguments, errors out"
not snap info
echo "With one non-snap argument, errors out"
not snap info /etc/passwd
snap info --unicode=always \
basic_1.0_all.snap \
"$TESTSLIB"/snaps/basic-desktop \
test-snapd-tools \
test-snapd-devmode \
core \
/etc/passwd \
test-snapd-python-webserver \
> out
PYTHONIOENCODING=utf8 python3 check.py < out
snap info --verbose "$TESTSLIB"/snaps/basic-desktop|MATCH "path: "
"$TESTSTOOLS"/snaps-state install-local basic-desktop
snap info basic-desktop|MATCH "license:[ ]+GPL-3.0"
# Ensure the basic snap has a grade of stable - Local snap file.
snap info --verbose basic_1.0_all.snap|MATCH "grade:\s*devel"
# Use locally installed snap
snap info --verbose snapd|MATCH "grade:\s*stable"
# Ensure the basic snap has no grade when not using --verbose - Local snap file.
snap info basic_1.0_all.snap|NOMATCH "grade:"
# This should not have a grade assigned. This snap doesn't have a grade in its snap.yaml
snap info --verbose test-snapd-tools|NOMATCH "grade:"
snap info --verbose basic_1.0_all.snap|MATCH "sha3-384:"
snap info --verbose test-snapd-tools|MATCH " ignore-validation:"
echo "Ensure we show friendly error messages"
snap info no-such-snap > out.stdout 2> out.stderr || true
MATCH 'no snap found for "no-such-snap"' < out.stderr
snap info no-such-snap no-such-other-snap > out.stdout 2> out.stderr || true
MATCH 'warning: no snap found for "no-such-snap"' < out.stdout
MATCH 'warning: no snap found for "no-such-other-snap"' < out.stdout
MATCH 'error: no valid snaps given' < out.stderr
snap info no-such-snap test-snapd-tools > out.stdout 2> out.stderr
MATCH 'warning: no snap found for "no-such-snap"' < out.stdout
# no error output generated
not test -s out.stderr
echo "Ensure we show versions as strings (LP: 1669291)"
snap info test-snapd-number-version | MATCH "edge:[ ]+2.10"
|