-
Notifications
You must be signed in to change notification settings - Fork 680
tests: add snap version invariant during restore phase of testing #16465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 5 commits
51de3ca
a6b7b7b
43c2f00
8ba5d3a
e17974c
b8fa7fe
8fa52f3
7b2ae67
8c7e324
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ show_help() { | |
| echo " leftover-defer-sh: defer.sh must not be left over by tests" | ||
| echo " broken-snaps: snaps must not be left around that are in a broken state" | ||
| echo " segmentation-violations: snapd must not have segmentation-violation errors in journal logs" | ||
| echo " check-snapd-version: the version of snapd during restore must be the same as during project prepare" | ||
| echo " snap-mount-dir: assert that reported snap mount directory is the same as at test start" | ||
| echo | ||
| echo "Supported invariants for 'set' action:" | ||
|
|
@@ -261,6 +262,26 @@ check_snap_mount_dir() { | |
| fi | ||
| } | ||
|
|
||
| check_snapd_version() { | ||
| if tests.nested is-nested; then | ||
| return 0 | ||
| fi | ||
| if command -v snap && systemctl is-active snapd.socket && systemctl is-active snapd.service; then | ||
| if tests.info is-snapd-from-archive && not tests.info is-reexec-enabled; then | ||
| # re-exec may be explicitly disabled in the test variant, in which case the version will not match | ||
| return 0 | ||
| fi | ||
|
Comment on lines
+274
to
+277
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we still need this branch?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, because some tests disable re-exec |
||
| if [[ "$SRU_VALIDATION" = "1" ]] || [[ -n "$PPA_GPG_KEY" ]] || [[ -n "$PPA_VALIDATION_NAME" ]]; then | ||
| # The snapd version will not be a testing version | ||
| return 0 | ||
| fi | ||
| snap version | grep snapd | MATCH "1337" || { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't exactly the version the test started with. I'd expect something like we do for the check-snap-mount-dir, i.e. record what's at the beginning of the test suite where we install the right package (sru, or a CI build) and check at the end that the version is still the same.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was my first approach but with that approach the cross-distro-reexec suite fails on amazon so I opted for this approach. |
||
| echo "tests.invariant: snapd version mismatch, expected 1337 but got $(snap version | grep snapd | awk '{print $2}')" >&2 | ||
| return 1 | ||
| } | ||
| fi | ||
| } | ||
|
|
||
| check_invariant() { | ||
| case "$1" in | ||
| root-files-in-home) | ||
|
|
@@ -296,6 +317,9 @@ check_invariant() { | |
| snap-mount-dir) | ||
| check_snap_mount_dir "$1" | ||
| ;; | ||
| check-snapd-version) | ||
|
maykathm marked this conversation as resolved.
Outdated
|
||
| check_snapd_version | ||
| ;; | ||
| *) | ||
| echo "tests.invariant: unknown invariant $1" >&2 | ||
| exit 1 | ||
|
|
@@ -316,6 +340,7 @@ main() { | |
| segmentation-violations | ||
| check-fakestore-cleaned | ||
| snap-mount-dir | ||
| check-snapd-version | ||
| " | ||
|
|
||
| case "$action" in | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.