portablectl: fix regression when using --force without extension parameters
c18f4eb9e9made it possible to use --force with various verbs, by going through the newer D-Bus methods. Except it didn't, as it regressed during PR review refactorings, and nobody noticed because there were no tests for it. Fix it, and add tests. Follow-up forc18f4eb9e9
This commit is contained in:
committed by
Luca Boccassi
parent
0e387e1295
commit
bdfa3f3a5c
@@ -43,12 +43,16 @@ EOF
|
||||
|
||||
portablectl "${ARGS[@]}" attach --now --runtime /usr/share/minimal_0.raw minimal-app0
|
||||
|
||||
portablectl is-attached minimal-app0
|
||||
portablectl inspect /usr/share/minimal_0.raw minimal-app0.service
|
||||
systemctl is-active minimal-app0.service
|
||||
systemctl is-active minimal-app0-foo.service
|
||||
systemctl is-active minimal-app0-bar.service && exit 1
|
||||
|
||||
portablectl "${ARGS[@]}" reattach --now --runtime /usr/share/minimal_1.raw minimal-app0
|
||||
|
||||
portablectl is-attached minimal-app0
|
||||
portablectl inspect /usr/share/minimal_0.raw minimal-app0.service
|
||||
systemctl is-active minimal-app0.service
|
||||
systemctl is-active minimal-app0-bar.service
|
||||
systemctl is-active minimal-app0-foo.service && exit 1
|
||||
@@ -61,6 +65,32 @@ portablectl detach --now --runtime /usr/share/minimal_1.raw minimal-app0
|
||||
portablectl list | grep -q -F "No images."
|
||||
busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1' && exit 1
|
||||
|
||||
# Ensure we don't regress (again) when using --force
|
||||
|
||||
portablectl "${ARGS[@]}" attach --force --now --runtime /usr/share/minimal_0.raw minimal-app0
|
||||
|
||||
portablectl is-attached --force minimal-app0
|
||||
portablectl inspect --force /usr/share/minimal_0.raw minimal-app0.service
|
||||
systemctl is-active minimal-app0.service
|
||||
systemctl is-active minimal-app0-foo.service
|
||||
systemctl is-active minimal-app0-bar.service && exit 1
|
||||
|
||||
portablectl "${ARGS[@]}" reattach --force --now --runtime /usr/share/minimal_1.raw minimal-app0
|
||||
|
||||
portablectl is-attached --force minimal-app0
|
||||
portablectl inspect --force /usr/share/minimal_0.raw minimal-app0.service
|
||||
systemctl is-active minimal-app0.service
|
||||
systemctl is-active minimal-app0-bar.service
|
||||
systemctl is-active minimal-app0-foo.service && exit 1
|
||||
|
||||
portablectl list | grep -q -F "minimal_1"
|
||||
busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1'
|
||||
|
||||
portablectl detach --force --now --runtime /usr/share/minimal_1.raw minimal-app0
|
||||
|
||||
portablectl list | grep -q -F "No images."
|
||||
busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1' && exit 1
|
||||
|
||||
# portablectl also works with directory paths rather than images
|
||||
|
||||
unsquashfs -dest /tmp/minimal_0 /usr/share/minimal_0.raw
|
||||
|
||||
Reference in New Issue
Block a user