summaryrefslogtreecommitdiffstats
path: root/test/units/TEST-13-NSPAWN.machined.sh
diff options
context:
space:
mode:
authorIvan Kruglov <mail@ikruglov.com>2024-10-23 16:02:26 +0200
committerIvan Kruglov <mail@ikruglov.com>2024-11-06 11:58:51 +0100
commit1e2cd07394027a1e314de6d73499bf2f80760078 (patch)
treeacf8b41637750ebbdec69c5c5519dc860fc6c477 /test/units/TEST-13-NSPAWN.machined.sh
parentmachine: introduce io.systemd.Machine.Open method (diff)
downloadsystemd-1e2cd07394027a1e314de6d73499bf2f80760078.tar.xz
systemd-1e2cd07394027a1e314de6d73499bf2f80760078.zip
machine: tests for io.systemd.Machine.Open
Diffstat (limited to '')
-rwxr-xr-xtest/units/TEST-13-NSPAWN.machined.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/units/TEST-13-NSPAWN.machined.sh b/test/units/TEST-13-NSPAWN.machined.sh
index 1da08415df..f9cbd92bba 100755
--- a/test/units/TEST-13-NSPAWN.machined.sh
+++ b/test/units/TEST-13-NSPAWN.machined.sh
@@ -367,6 +367,25 @@ varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List
(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name": ".host"}' | grep 'acquireUIDShift')
varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name": ".host", "acquireMetadata": "yes"}' | grep 'UIDShift'
+# test io.systemd.Machine.Open
+
+# Reducing log level here is to work-around check in end.service (end.sh). Read https://github.com/systemd/systemd/pull/34867 for more details
+systemctl service-log-level systemd-machined info
+(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host"}')
+(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": ""}')
+(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": null}')
+(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "foo"}')
+systemctl service-log-level systemd-machined debug
+
+varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "tty"}'
+varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "login"}'
+varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "shell"}'
+
+rm -f /tmp/none-existent-file
+varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "shell", "user": "root", "path": "/bin/sh", "args": ["/bin/sh", "-c", "echo $FOO > /tmp/none-existent-file"], "environment": ["FOO=BAR"]}'
+timeout 30 bash -c "until test -e /tmp/none-existent-file; do sleep .5; done"
+grep -q "BAR" /tmp/none-existent-file
+
# test io.systemd.MachineImage.List
varlinkctl --more call /run/systemd/machine/io.systemd.MachineImage io.systemd.MachineImage.List '{}' | grep 'long-running'
varlinkctl --more call /run/systemd/machine/io.systemd.MachineImage io.systemd.MachineImage.List '{}' | grep '.host'