1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
summary: Checks parallel installation of snaps from local files
details: |
Check it is allowed to install parallel instances through
parallel-instances config using local snaps.
restore: |
snap set system experimental.parallel-instances=null
execute: |
echo "Install the regular snap"
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh
if "$TESTSTOOLS"/snaps-state install-local-as test-snapd-sh test-snapd-sh_foo 2>run.err; then
echo "install-local-as was expected to fail"
exit 1
fi
MATCH 'experimental feature disabled' < run.err
snap set system experimental.parallel-instances=true
SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
for instance in foo longname; do
echo "Install snap instance named test-snapd-sh_$instance"
expected="^test-snapd-sh_$instance 1.0 installed\$"
"$TESTSTOOLS"/snaps-state install-local-as test-snapd-sh "test-snapd-sh_$instance" | MATCH "$expected"
test -d "$SNAP_MOUNT_DIR/test-snapd-sh_$instance/x1"
#shellcheck disable=SC2016
"test-snapd-sh_$instance.sh" -c 'echo hello data from $SNAP_INSTANCE_NAME > $SNAP_DATA/data'
MATCH "hello data from test-snapd-sh_$instance" < "/var/snap/test-snapd-sh_$instance/x1/data"
su -l -c "test-snapd-sh_$instance.sh -c 'echo hello user data from \$SNAP_INSTANCE_NAME > \$SNAP_USER_DATA/data'" test
MATCH "hello user data from test-snapd-sh_$instance" < "/home/test/snap/test-snapd-sh_$instance/x1/data"
done
echo "All snaps are listed"
snap list | MATCH '^test-snapd-sh '
snap list | MATCH '^test-snapd-sh_foo '
snap list | MATCH '^test-snapd-sh_longname '
echo "Removing one instance does not remove other instances' directories"
snap remove --purge test-snapd-sh_foo
test -d "$SNAP_MOUNT_DIR/test-snapd-sh_longname/x1"
test -d "$SNAP_MOUNT_DIR/test-snapd-sh/x1"
|