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
|
summary: Check that find works with private snaps.
details: |
These tests rely on the existence of a snap in the remote store set to private.
In order to do the full checks, it also needs the credentials of the owner of that
snap set in the environment variables SPREAD_STORE_USER and SPREAD_STORE_PASSWORD, if
they are not present then only the negative check (private snap does not show up in
the find results without specifying private search or without the owner logged) is
performed.
systems:
# ppc64el disabled because of https://bugs.launchpad.net/snappy/+bug/1655594
- -ubuntu-*-ppc64el
# TODO: issues with dbus
- -ubuntu-core-22-*
restore: |
snap logout || true
execute: |
echo "When a snap is private it doesn't show up in the find without login and without specifying private search"
snap find test-snapd-private | NOMATCH 'test-snapd-private +[0-9]+\.[0-9]+'
echo "When a snap is private it doesn't show up in the find --private results without login"
snap find test-snapd-private --private | NOMATCH 'test-snapd-private +[0-9]+\.[0-9]+'
echo "Given account store credentials are available"
# we don't have expect available on ubuntu-core, so the authenticated check need to be skipped on those systems
if [ -n "$SPREAD_STORE_USER" ] && [ -n "$SPREAD_STORE_PASSWORD" ] && os.query is-classic; then
echo "And the user has logged in"
expect -f "$TESTSLIB"/successful_login.exp
echo "Then a private snap belonging to that user shows up in the find results and nothing else"
result=$(snap find test-snapd-private2 --private)
echo "$result" | MATCH 'test-snapd-private2 +[0-9]+\.[0-9]+'
echo "$result" | NOMATCH 'test-snapd-private +[0-9]+\.[0-9]+'
echo "$result" | NOMATCH 'test-snapd-public +[0-9]+\.[0-9]+'
echo "And searching for private snaps shows all of them and anything else"
result=$(snap find --private)
echo "$result" | MATCH 'test-snapd-private2 +[0-9]+\.[0-9]+'
echo "$result" | MATCH 'test-snapd-private +[0-9]+\.[0-9]+'
echo "$result" | NOMATCH 'test-snapd-public +[0-9]+\.[0-9]+'
echo "And searching for public snaps does not show private ones"
result=$(snap find test-snapd)
echo "$result" | NOMATCH 'test-snapd-private2 +[0-9]+\.[0-9]+'
echo "$result" | NOMATCH 'test-snapd-private +[0-9]+\.[0-9]+'
echo "$result" | MATCH 'test-snapd-public +[0-9]+\.[0-9]+'
fi
|