test: cover attaching with a profile that does not exist
Both attach and reattach must fail, and the latter must not detach the image first. (cherry picked from commit 430f8962cf2e454cc9b474a22b92a89a26872e9b)
This commit is contained in:
committed by
Luca Boccassi
parent
0b1c0782bb
commit
d6bf5fbaf2
@@ -17,6 +17,11 @@ if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then
|
||||
ARGS+=(--profile=trusted)
|
||||
fi
|
||||
|
||||
# Attaching with a profile that doesn't exist must fail and must not leave anything behind
|
||||
(! portablectl attach --runtime --profile=nonexistent /usr/share/minimal_0.raw minimal-app0)
|
||||
test ! -e /run/systemd/system.attached/minimal-app0.service
|
||||
test ! -e /run/systemd/system.attached/minimal-app0.service.d
|
||||
|
||||
portablectl "${ARGS[@]}" attach --now --runtime /usr/share/minimal_0.raw minimal-app0
|
||||
|
||||
portablectl is-attached minimal-app0
|
||||
@@ -29,6 +34,12 @@ systemctl is-active minimal-app0-bar.service && exit 1
|
||||
cat /run/systemd/system.attached/minimal-app0-foo.service.d/20-portable.conf
|
||||
grep -q -F 'root=signed+squashfs:' /run/systemd/system.attached/minimal-app0-foo.service.d/20-portable.conf
|
||||
|
||||
# Reattaching with a profile that doesn't exist must fail without detaching the image first
|
||||
(! portablectl reattach --now --runtime --profile=nonexistent /usr/share/minimal_1.raw minimal-app0)
|
||||
portablectl is-attached minimal-app0
|
||||
systemctl is-active minimal-app0.service
|
||||
systemctl is-active minimal-app0-foo.service
|
||||
|
||||
portablectl "${ARGS[@]}" reattach --now --runtime /usr/share/minimal_1.raw minimal-app0
|
||||
|
||||
portablectl is-attached minimal-app0
|
||||
|
||||
Reference in New Issue
Block a user