From: Philip Withnall Date: Thu, 18 Jun 2026 12:57:35 +0000 (+0100) Subject: test: Test error handling for non-existent targets in sysupdate X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dffff8be674ec4f9a963dc535cc0988b25684581;p=thirdparty%2Fsystemd.git test: Test error handling for non-existent targets in sysupdate Primarily I want to test the new varlink error, but this will also test the `systemd-sysupdate` CLI behaviour too. --- diff --git a/test/units/TEST-72-SYSUPDATE.sh b/test/units/TEST-72-SYSUPDATE.sh index f8ba6035df7..a8bc7432c18 100755 --- a/test/units/TEST-72-SYSUPDATE.sh +++ b/test/units/TEST-72-SYSUPDATE.sh @@ -589,6 +589,18 @@ EOF verify_version "$blockdev" "$sector_size" v8 1 verify_version_current "$blockdev" "$sector_size" v9 2 + # Test that checking for an update on a non-existent target fails + # (for backwards compatibility reasons, the validation in sysupdate-cli is + # less strict) + if [[ "$client" == "sysupdate-cli" ]]; then + (! "$SYSUPDATE" --verify=no check-new --component=../) |& grep "Component name invalid" >/dev/null + elif [[ "$client" == "varlink" ]]; then + (! varlinkctl call "$VARLINK_SOCKET" io.systemd.SysUpdate.CheckNew '{"target":{"class":"component","name":"../"}}') |& grep org.varlink.service.InvalidParameter >/dev/null + (! varlinkctl call "$VARLINK_SOCKET" io.systemd.SysUpdate.CheckNew '{"target":{"class":"component","name":"doesnotexist"}}') |& grep io.systemd.SysUpdate.NoSuchTarget >/dev/null + else + exit 1 + fi + # Cleanup [[ -b "$blockdev" ]] && losetup --detach "$blockdev" rm "$BACKING_FILE"