systemd/SOURCES/0962-Add-failing-test-to-sh...

58 lines
1.8 KiB
Diff

From 471f790115b2b0a56328cbf14a6e0f51c1176b62 Mon Sep 17 00:00:00 2001
From: "Greg \"GothAck\" Miell" <greg@gothack.ninja>
Date: Fri, 27 Dec 2019 14:36:49 +0000
Subject: [PATCH] Add failing test to show service.d global drop-in does not
get overridden by more specific dropins
(cherry picked from commit f5dd6e50a781b83bc6b1d8e018783661142aabd0)
Related: #2156620
---
test/TEST-15-DROPIN/test-dropin.sh | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/test/TEST-15-DROPIN/test-dropin.sh b/test/TEST-15-DROPIN/test-dropin.sh
index 5419169f7b..a9d1ef0a10 100755
--- a/test/TEST-15-DROPIN/test-dropin.sh
+++ b/test/TEST-15-DROPIN/test-dropin.sh
@@ -118,6 +118,31 @@ EOF
clear_services a b c
}
+test_hierarchical_dropins () {
+ echo "Testing hierarchical dropins..."
+ echo "*** test service.d/ top level drop-in"
+ create_services a-b-c
+ check_ko a-b-c ExecCondition "/bin/echo service.d"
+ check_ko a-b-c ExecCondition "/bin/echo a-.service.d"
+ check_ko a-b-c ExecCondition "/bin/echo a-b-.service.d"
+ check_ko a-b-c ExecCondition "/bin/echo a-b-c.service.d"
+
+ for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
+ mkdir -p /usr/lib/systemd/system/$dropin
+ echo "
+[Service]
+ExecCondition=/bin/echo $dropin
+ " >/usr/lib/systemd/system/$dropin/override.conf
+ systemctl daemon-reload
+ check_ok a-b-c ExecCondition "/bin/echo $dropin"
+ done
+ for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
+ rm -rf /usr/lib/systemd/system/$dropin
+ done
+
+ clear_services a-b-c
+}
+
test_template_dropins () {
echo "Testing template dropins..."
@@ -303,6 +328,7 @@ test_invalid_dropins () {
}
test_basic_dropins
+test_hierarchical_dropins
test_template_dropins
test_alias_dropins
test_masked_dropins