Skip to content
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

tests: fix for preseeding failures #8528

Merged
merged 13 commits into from Apr 28, 2020
Merged

Conversation

zyga
Copy link
Collaborator

@zyga zyga commented Apr 20, 2020

This patch fixes the various preseed tests in two ways:

  • re-packing the core snap is no longer done (preseed), both 19.10 and 20.40 use core18 and snapd for seeds.
  • restore sections were not sourcing the preseed.sh script
  • prepare now mounts, restore now unmounts, for regularity
  • mounted qemu-nbd no longer hangs ssh on failure and is run as a systemd service
  • removed preseed-snapd-snap test as the functionality is now covered by the main preseed test (no need to inject/hack core/snapd snaps for preseeding).

@zyga
Copy link
Collaborator Author

zyga commented Apr 20, 2020

@stolowski this hangs in the preseed tests, oh well :-(

LXD snap pulls in core18, not core, so the test details had to change.
In addition, the test will no longer hang on failure. Restore now
correctly sources the helper script to perform the unmount. Unmounting
is no longer performed in the execute block.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
@zyga zyga changed the title tests: naive fix for preseeding failure tests: fix for pre-seeding failures Apr 21, 2020
tests/lib/preseed.sh Outdated Show resolved Hide resolved
@zyga zyga marked this pull request as ready for review April 21, 2020 09:48
@stolowski stolowski self-requested a review April 21, 2020 09:53
This prevents interaction with spread's ssh session.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
MATCH "Do .+ start-snap-services +Start snap \"core18\" \([0-9]+\) services" < tasks.log
MATCH "Do .+ run-hook +Run health check of \"core18\" snap" < tasks.log
MATCH "Do .+ run-hook +Run install hook of \"lxd\" snap if present" < tasks.log
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I wonder if we should be explicit here that this applies to 19.10 and have an else that just fails if we run it on something unexpected?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will do.

@stolowski stolowski changed the title tests: fix for pre-seeding failures tests: fix for preseeding failures Apr 28, 2020
Copy link
Contributor

@stolowski stolowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+0.5 (for zyga's changes re prepare/restore and introduction of systemd unit).

Copy link
Member

@anonymouse64 anonymouse64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one errant TODO which I think can be removed now

@@ -4,7 +4,7 @@ description: |
can be undone with --reset flag.

# TODO: reenable for ubuntu-20.04-*, that now uses the snapd snap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this TODO can be deleted, no?

qemu-nbd -c /dev/nbd0 "$CLOUD_IMAGE"
# Run qemu-ndb as a service, so that it does not interact with ssh
# stdin/stdout it would otherwise inherit from the spread session.
systemd-run --system --service-type=forking --unit=qemu-ndb-preseed.service "$(command -v qemu-nbd)" --fork -c /dev/nbd0 "$CLOUD_IMAGE"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice fix!

@stolowski stolowski added the ⚠ Critical High-priority stuff (e.g. to fix master) label Apr 28, 2020
Copy link
Collaborator Author

@zyga zyga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (changes from Pawel)

@@ -4,7 +4,7 @@ description: |
can be undone with --reset flag.

# TODO: reenable for ubuntu-20.04-*, that now uses the snapd snap
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this in the next pass.

@zyga zyga merged commit c2dd6c7 into snapcore:master Apr 28, 2020
@zyga zyga deleted the fix/master-preseed-test branch April 28, 2020 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠ Critical High-priority stuff (e.g. to fix master)
Projects
None yet
5 participants