Skip to content

Commit 9570b76

Browse files
committed
tests: add snapd version check as restore invariant
1 parent 304e3fa commit 9570b76

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

tests/lib/prepare.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ prepare_classic() {
610610
mkdir -p /etc/dbus-1/system.d
611611
systemctl reload dbus.service
612612
fi
613+
snap version | grep snapd | awk '{print $2}' > "/var/tmp/snapd-testing-version"
613614
}
614615

615616
ensure_snapcraft() {
@@ -1989,6 +1990,7 @@ prepare_ubuntu_core() {
19891990
fi
19901991

19911992
disable_kernel_rate_limiting
1993+
snap version | grep snapd | awk '{print $2}' > "/var/tmp/snapd-testing-version"
19921994
}
19931995

19941996
cache_snaps(){

tests/lib/tools/tests.invariant

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ check_fakestore_cleaned() {
217217
fi
218218
}
219219

220+
check_snapd_version() {
221+
snap version | grep -q "$(cat /var/tmp/snapd-testing-version)"
222+
}
223+
220224
check_invariant() {
221225
case "$1" in
222226
root-files-in-home)
@@ -249,6 +253,9 @@ check_invariant() {
249253
check-fakestore-cleaned)
250254
check_fakestore_cleaned
251255
;;
256+
check-snapd-version)
257+
check_snapd_version
258+
;;
252259
*)
253260
echo "tests.invariant: unknown invariant $1" >&2
254261
exit 1
@@ -268,6 +275,7 @@ main() {
268275
cgroups
269276
segmentation-violations
270277
check-fakestore-cleaned
278+
check-snapd-version
271279
"
272280

273281
case "$action" in

0 commit comments

Comments
 (0)