sysupdate: Add varlink ListTargets() method
And add integration tests for it using `jq`.
This commit is contained in:
@@ -647,8 +647,11 @@ MatchPattern=some-component_@v
|
||||
CurrentSymlink=some-component
|
||||
EOF
|
||||
"$SYSUPDATE" --json=short components | grep -F '{"default":false,"components":["some-component"]}' >/dev/null
|
||||
varlinkctl call "$VARLINK_SOCKET" io.systemd.SysUpdate.ListTargets | jq -e '.targets | all(.id.class != "host")' >/dev/null
|
||||
mkdir /run/sysupdate.d
|
||||
"$SYSUPDATE" --json=short components | grep -F '{"default":false,"components":["some-component"]}' >/dev/null
|
||||
varlinkctl call "$VARLINK_SOCKET" io.systemd.SysUpdate.ListTargets | jq -e '.targets | all(.id.class != "host")' >/dev/null
|
||||
[[ $(varlinkctl call "$VARLINK_SOCKET" io.systemd.SysUpdate.ListTargets | jq -r '.targets[0].id.name') == "some-component" ]]
|
||||
|
||||
# Regression test for https://github.com/systemd/systemd/issues/42330 — the
|
||||
# 'pending'/'reboot' verbs and the '--reboot' switch compare the newest installed
|
||||
@@ -1441,4 +1444,8 @@ cmp "$WORKDIR/source/pack-v2" "$WORKDIR/blobs/pack-v2"
|
||||
rm -rf "$CONFIGDIR/01-manifest-yes-and-retry.transfer" \
|
||||
"$WORKDIR/source/pack-v1" "$WORKDIR/source/pack-v2"
|
||||
|
||||
# Test that listing components/targets when none are configured gives an empty list.
|
||||
"$SYSUPDATE" components |& grep "No components defined." >/dev/null
|
||||
[[ $(varlinkctl call "$VARLINK_SOCKET" io.systemd.SysUpdate.ListTargets | jq -r '.targets') == "[]" ]]
|
||||
|
||||
touch /testok
|
||||
|
||||
Reference in New Issue
Block a user