Skip to content

Commit 519637a

Browse files
committed
tests/main: account for opensuse defaulting to /var/lib/snapd/snap
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
1 parent 711d8c7 commit 519637a

3 files changed

Lines changed: 18 additions & 25 deletions

File tree

tests/main/debug-execution/task.yaml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,13 @@ execute: |
164164
# MATCH 'is-reexecd: false' < snap-yes-reexec.out
165165
# MATCH 'self-exe: /snap/snapd/.*/usr/bin/snap' < snap-yes-reexec.out
166166
case "$SPREAD_SYSTEM" in
167-
arch-linux-*|fedora-*|centos-*)
167+
arch-linux-*|fedora-*|centos-*|opensuse-*)
168168
# no /snap -> /var/lib/snapd/snap symlink by default
169169
MATCH 'is-reexecd: false' < snap-yes-reexec.out
170170
MATCH 'self-exe: /usr/bin/snap' < snap-yes-reexec.out
171171
172172
MATCH 'is-reexecd: false' < snap-force-reexec.out
173173
;;
174-
opensuse-*)
175-
# snap mount dir is /snap
176-
MATCH 'is-reexecd: true' < snap-yes-reexec.out
177-
MATCH 'self-exe: /snap/snapd/.*/usr/bin/snap' < snap-yes-reexec.out
178-
179-
MATCH 'is-reexecd: true' < snap-force-reexec.out
180-
;;
181174
amazon-linux-*)
182175
# has /snap -> /var/lib/snapd symlink
183176
MATCH 'is-reexecd: true' < snap-yes-reexec.out
@@ -208,15 +201,9 @@ execute: |
208201
*)
209202
# arch and opensuse have AppArmor installed
210203
MATCH 'apparmor-parser: (/usr)?/sbin/apparmor_parser' < snap-apparmor-default.out
211-
case "$SPREAD_SYSTEM" in
212-
opensuse-*)
213-
MATCH 'internal: true' < snap-apparmor-force-reexec.out
214-
;;
215-
*)
216-
# arch has no /snap -> /var/lib/snapd/snap symlink
217-
MATCH 'internal: false' < snap-apparmor-force-reexec.out
218-
;;
219-
esac
204+
# no /snap -> /var/lib/snapd/snap symlink on Arch or openSUSE
205+
MATCH 'internal: false' < snap-apparmor-force-reexec.out
206+
;;
220207
esac
221208
MATCH 'internal: false' < snap-apparmor-default.out
222209

tests/main/graphical-user-daemons/task.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,8 @@ restore: |
1313
snap set system experimental.user-daemons=false
1414
1515
execute: |
16-
case "$SPREAD_SYSTEM" in
17-
amazon-*|arch-*|centos-*|fedora-*)
18-
SNAP_BIN="/var/lib/snapd/snap/bin"
19-
;;
20-
*)
21-
SNAP_BIN="/snap/bin"
22-
;;
23-
esac
16+
SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
17+
SNAP_BIN="$SNAP_MOUNT_DIR/bin"
2418
2519
echo "Test that the non-daemon apps have binaries"
2620
test -L "$SNAP_BIN"/test-snapd-graphical-user-daemons.normal

tests/main/migrate-snap-mount-dir/task.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ prepare: |
1414
SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
1515
echo "$SNAP_MOUNT_DIR" > start-mount-dir
1616
17+
if [ "$SNAP_MOUNT_DIR" != "/snap" ]; then
18+
# openSUSE supports both locations, but defaults to /var/lib/snapd/snap
19+
tests.systemd stop-unit snapd.service
20+
echo "Ensure all snaps are gone"
21+
snapd.tool exec snap-mgmt --purge
22+
23+
mkdir -p /snap
24+
25+
systemctl start snapd.service
26+
snap wait system seed.loaded
27+
fi
28+
1729
snap set system experimental.user-daemons=true
1830
# although state reset should clean that up
1931
tests.cleanup defer snap unset system experimental.user-daemons

0 commit comments

Comments
 (0)