diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-06-27 11:30:07 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-06-27 11:30:07 +0200 |
commit | ebc4a76a64ff23d12f3fa057fed25e7ba5d6c59e (patch) | |
tree | 0c4e9c417669426d8f6634e948078bde5fb04920 /test | |
parent | varlink: add ability to invoke and talk to remote service binary via SSH (diff) | |
download | systemd-ebc4a76a64ff23d12f3fa057fed25e7ba5d6c59e.tar.xz systemd-ebc4a76a64ff23d12f3fa057fed25e7ba5d6c59e.zip |
ci: add simple test for the new "ssh-exec:" varlink logic
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/TEST-74-AUX-UTILS.varlinkctl.sh | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/units/TEST-74-AUX-UTILS.varlinkctl.sh b/test/units/TEST-74-AUX-UTILS.varlinkctl.sh index 5324b9501a..a0797469a4 100755 --- a/test/units/TEST-74-AUX-UTILS.varlinkctl.sh +++ b/test/units/TEST-74-AUX-UTILS.varlinkctl.sh @@ -75,7 +75,7 @@ rm_rf_sshbindir() { trap rm_rf_sshbindir EXIT -# Create a fake "ssh" binary that validates everything works as expected +# Create a fake "ssh" binary that validates everything works as expected if invoked for the "ssh-unix:" Varlink transport cat > "$SSHBINDIR"/ssh <<'EOF' #!/bin/sh @@ -87,10 +87,29 @@ test "$3" = "foobar" exec socat - UNIX-CONNECT:/run/systemd/journal/io.systemd.journal EOF +chmod +x "$SSHBINDIR"/ssh + +SYSTEMD_SSH="$SSHBINDIR/ssh" varlinkctl info ssh-unix:foobar:/run/systemd/journal/io.systemd.journal + +# Now build another fake "ssh" binary that does the same for "ssh-exec:" +cat > "$SSHBINDIR"/ssh <<'EOF' +#!/bin/sh +set -xe + +test "$1" = "-e" +test "$2" = "none" +test "$3" = "-T" +test "$4" = "foobar" +test "$5" = "env" +test "$6" = "SYSTEMD_VARLINK_LISTEN=-" +test "$7" = "systemd-sysext" + +SYSTEMD_VARLINK_LISTEN=- exec systemd-sysext +EOF chmod +x "$SSHBINDIR"/ssh -SYSTEMD_SSH="$SSHBINDIR/ssh" varlinkctl info ssh:foobar:/run/systemd/journal/io.systemd.journal +SYSTEMD_SSH="$SSHBINDIR/ssh" varlinkctl info ssh-exec:foobar:systemd-sysext # Go through all varlink sockets we can find under /run/systemd/ for some extra coverage find /run/systemd/ -name "io.systemd*" -type s | while read -r socket; do |