From c43b233f204514d54af8297882b5a26872dcbaad Mon Sep 17 00:00:00 2001 From: Andrew Phelps Date: Tue, 2 Apr 2024 22:34:56 -0400 Subject: [PATCH] tests/main/component-hooks: check apparmor profile creation/removal --- tests/main/component-hooks/task.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/main/component-hooks/task.yaml b/tests/main/component-hooks/task.yaml index edd8fd9937d0..4b35f42797cf 100644 --- a/tests/main/component-hooks/task.yaml +++ b/tests/main/component-hooks/task.yaml @@ -25,3 +25,14 @@ execute: | # the hook writes this file if it runs (and uses the network via the network # plug) successfully test -f /var/snap/snap-with-comps/common/install-done + + # make sure that security profiles got generated + test -f /var/lib/snapd/apparmor/profiles/snap.snap-with-comps+comp-with-install-hook.hook.install + test -f /var/lib/snapd/seccomp/bpf/snap.snap-with-comps+comp-with-install-hook.hook.install.src + test -f /var/lib/snapd/seccomp/bpf/snap.snap-with-comps+comp-with-install-hook.hook.install.bin + + # remove the snap and make sure that the profiles get removed + snap remove snap-with-comps + not test -f /var/lib/snapd/apparmor/profiles/snap.snap-with-comps+comp-with-install-hook.hook.install + not test -f /var/lib/snapd/seccomp/bpf/snap.snap-with-comps+comp-with-install-hook.hook.install.src + not test -f /var/lib/snapd/seccomp/bpf/snap.snap-with-comps+comp-with-install-hook.hook.install.bin