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: add core18 only hooks test and fix running core18 only on classic #6118

Merged
merged 5 commits into from Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/snap-confine/mount-support.c
Expand Up @@ -702,8 +702,8 @@ void sc_populate_mount_ns(struct sc_apparmor *apparmor, int snap_update_ns_fd,
// TODO: fold this into bootstrap
setup_private_pts();

// setup quirks for specific snaps
if (distro == SC_DISTRO_CLASSIC) {
// setup quirks for specific snaps *only* for the old core snap
if (distro == SC_DISTRO_CLASSIC && sc_streq(base_snap_name, "core")) {
sc_setup_quirks();
}
// setup the security backend bind mounts
Expand Down
@@ -0,0 +1,3 @@
#!/bin/sh -e

touch "$SNAP_COMMON"/configure-ran
@@ -0,0 +1,5 @@
name: test-snapd-with-configure-core18
version: 1.0
summary: Basic snap with a configure hook for core18
description: A basic snap with a passthrough configure hook for core18
base: core18
31 changes: 31 additions & 0 deletions tests/main/core18-configure-hook/task.yaml
@@ -0,0 +1,31 @@
summary: Check that snaps with configure work on core18 only

systems: [-ubuntu-core-*]

prepare: |
echo "Ensure empty state"
#shellcheck source=tests/lib/systemd.sh
. "$TESTSLIB/systemd.sh"
echo "Ensure all snaps are gone"
/usr/lib/snapd/snap-mgmt --purge

systemd_stop_units snapd.service
rm -f /var/lib/snapd/state.json
systemctl start snapd
snap wait system seed.loaded

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change


execute: |
#shellcheck source=tests/lib/snaps.sh
. "$TESTSLIB"/snaps.sh

echo "Install test snap"
install_local test-snapd-with-configure-core18

snap list | MATCH core18
if snap list | grep -E -q "^core "; then
echo "core got installed but shouldn't. test broken"
exit 1
fi

test -e /var/snap/test-snapd-with-configure-core18/common/configure-ran