summary: Ensure that SNAP_USER_DATA directory is created by snap-confine
# This is blacklisted on debian because debian doesn't use apparmor yet
systems: [-debian-8]
details: |
    A regression was found in snap-confine where the new code path in snapd was
    not active yet but the corresponding code path in snap-confine was already
    removed. This resulted in the $SNAP_USER_DATA directory not being created
    at runtime.
    This test checks that it is actually created
prepare: |
    echo "Having installed the snapd-hacker-toolbelt snap"
    snap install snapd-hacker-toolbelt
    echo "Having removed the SNAP_USER_DATA directory"
    rm -rf "$HOME/snap/snapd-hacker-toolbelt/"
execute: |
    cd /
    echo "We can now run snapd-hacker-toolbelt.busybox true"
    /snap/bin/snapd-hacker-toolbelt.busybox true
    echo "And see that the SNAP_USER_DATA directory was created"
    test -d $HOME/snap/snapd-hacker-toolbelt
restore: |
    snap remove --purge snapd-hacker-toolbelt
    rm -rf "$HOME/snap/snapd-hacker-toolbelt/"
