summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2020-07-03 18:45:19 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-07-07 10:09:24 +0200
commitcda667722c2218cf1a0185284d2a87f8a25f1b2d (patch)
tree0e97f4ea9ed8373ddaef00c7cd4fa866e1ceb8c2 /test
parent77ecc1aaa54947d4babd57110e0dee0457f7ba4e (diff)
downloadsystemd-cda667722c2218cf1a0185284d2a87f8a25f1b2d.tar.gz
core: refresh unit cache when building a transaction if UNIT_NOT_FOUND
When a command asks to load a unit directly and it is in state UNIT_NOT_FOUND, and the cache is outdated, we refresh it and attempto to load again. Use the same logic when building up a transaction and a dependency in UNIT_NOT_FOUND state is encountered. Update the unit test to exercise this code path.
Diffstat (limited to 'test')
-rwxr-xr-xtest/units/testsuite-48.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/units/testsuite-48.sh b/test/units/testsuite-48.sh
index 93e5e98e42..03231e71b1 100755
--- a/test/units/testsuite-48.sh
+++ b/test/units/testsuite-48.sh
@@ -53,6 +53,33 @@ systemctl start testservice-48.service
systemctl is-active testservice-48.service
+# Stop and remove, and try again to exercise the transaction setup code path by
+# having the target pull in the unloaded but available unit
+systemctl stop testservice-48.service testservice-48.target
+rm -f /run/systemd/system/testservice-48.service /run/systemd/system/testservice-48.target
+systemctl daemon-reload
+
+sleep 3.1
+
+cat > /run/systemd/system/testservice-48.target <<EOF
+[Unit]
+Conflicts=shutdown.target
+Wants=testservice-48.service
+EOF
+
+systemctl daemon-reload
+
+systemctl start testservice-48.target
+
+cat > /run/systemd/system/testservice-48.service <<EOF
+[Service]
+ExecStart=/bin/sleep infinity
+EOF
+
+systemctl restart testservice-48.target
+
+systemctl is-active testservice-48.service
+
echo OK > /testok
exit 0