]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-15: add test for template aliases 19453/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 29 Apr 2021 07:47:23 +0000 (09:47 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 4 May 2021 15:59:34 +0000 (17:59 +0200)
test/units/testsuite-15.sh

index ae63d06833d22f498c86409314ccb7c1bd1dca1b..c3784e299d5c8689bc8faa6d31a40075cebba8de 100755 (executable)
@@ -148,6 +148,32 @@ test_linked_units () {
     clear_services test15-a test15-b
 }
 
+test_template_alias() {
+    echo "Testing instance alias..."
+    echo "*** forward"
+
+    create_service test15-a@
+    ln -s test15-a@inst.service /etc/systemd/system/test15-b@inst.service  # alias
+
+    check_ok test15-a@inst Names test15-a@inst.service
+    check_ok test15-a@inst Names test15-b@inst.service
+
+    check_ok test15-a@other Names test15-a@other.service
+    check_ko test15-a@other Names test15-b@other.service
+
+    echo "*** reverse"
+
+    systemctl daemon-reload
+
+    check_ok test15-b@inst Names test15-a@inst.service
+    check_ok test15-b@inst Names test15-b@inst.service
+
+    check_ko test15-b@other Names test15-a@other.service
+    check_ok test15-b@other Names test15-b@other.service
+
+    clear_services test15-a@ test15-b@
+}
+
 test_hierarchical_dropins () {
     echo "Testing hierarchical dropins..."
     echo "*** test service.d/ top level drop-in"
@@ -490,6 +516,7 @@ test_invalid_dropins () {
 
 test_basic_dropins
 test_linked_units
+test_template_alias
 test_hierarchical_dropins
 test_template_dropins
 test_alias_dropins