]> git.feebdaed.xyz Git - 0xmirror/pi-hole.git/commitdiff
Adjust test to mock PID1 to be systemd
authorChristian König <github@yubiuser.dev>
Tue, 27 May 2025 21:51:04 +0000 (23:51 +0200)
committerChristian König <github@yubiuser.dev>
Tue, 27 May 2025 21:52:46 +0000 (23:52 +0200)
Signed-off-by: Christian König <github@yubiuser.dev>
test/_centos_10.Dockerfile
test/_centos_9.Dockerfile
test/_fedora_40.Dockerfile
test/_fedora_41.Dockerfile
test/_fedora_42.Dockerfile
test/test_any_automated_install.py

index 78a89789efa297e25757856d3acf3904394c8c60..c6b2ca75c5b45b99d21536bcba564f1f4f648456 100644 (file)
@@ -1,7 +1,7 @@
 FROM quay.io/centos/centos:stream10
 # Disable SELinux
 RUN echo "SELINUX=disabled" > /etc/selinux/config
-RUN yum install -y --allowerasing curl git initscripts
+RUN yum install -y --allowerasing curl git
 
 ENV GITDIR=/etc/.pihole
 ENV SCRIPTDIR=/opt/pihole
index 73f53fa5dc1f47c0de02bd1ec0440c41b012da15..0e12edabbb2dc51c3c90a8b07ebc04a762cb2610 100644 (file)
@@ -1,7 +1,7 @@
 FROM quay.io/centos/centos:stream9
 # Disable SELinux
 RUN echo "SELINUX=disabled" > /etc/selinux/config
-RUN yum install -y --allowerasing curl git initscripts
+RUN yum install -y --allowerasing curl git
 
 ENV GITDIR=/etc/.pihole
 ENV SCRIPTDIR=/opt/pihole
index 43913895eda6602a24ddc7b7fa39da056e887705..56be9d84ff4ddcfa118da2ca6d123699410f29ec 100644 (file)
@@ -1,5 +1,5 @@
 FROM fedora:40
-RUN dnf install -y git initscripts
+RUN dnf install -y git
 
 ENV GITDIR=/etc/.pihole
 ENV SCRIPTDIR=/opt/pihole
index c03371a52934b8d2d87a310ffa7ba1c35311a81a..2a9ecf70414d714465826070f35d575c9ee5ca6d 100644 (file)
@@ -1,5 +1,5 @@
 FROM fedora:41
-RUN dnf install -y git initscripts
+RUN dnf install -y git
 
 ENV GITDIR=/etc/.pihole
 ENV SCRIPTDIR=/opt/pihole
index 90b17c0bd9f2b2dadb966b8feb160f2237b345c8..34c7ef5d975f2ab152bf8146d4bc76af7e207784 100644 (file)
@@ -1,5 +1,5 @@
 FROM fedora:42
-RUN dnf install -y git initscripts
+RUN dnf install -y git
 
 ENV GITDIR=/etc/.pihole
 ENV SCRIPTDIR=/opt/pihole
index 0fa0453ae21afb58814a0487b185a0bee29802ef..f10d25762dc8c7b5211c0a0bb861a2e574f4aa26 100644 (file)
@@ -66,6 +66,14 @@ def test_installPihole_fresh_install_readableFiles(host):
     mock_command("dialog", {"*": ("", "0")}, host)
     # mock git pull
     mock_command_passthrough("git", {"pull": ("", "0")}, host)
+    # mock PID 1 to pretend to be systemd
+    mock_command_2(
+        "ps",
+        {
+            "-p 1": ("systemd", "0"),
+        },
+        host,
+    )
     # mock systemctl to not start FTL
     mock_command_2(
         "systemctl",
@@ -73,6 +81,7 @@ def test_installPihole_fresh_install_readableFiles(host):
             "enable pihole-FTL": ("", "0"),
             "restart pihole-FTL": ("", "0"),
             "start pihole-FTL": ("", "0"),
+            "stop pihole-FTL": ("", "0"),
             "*": ('echo "systemctl call with $@"', "0"),
         },
         host,
@@ -131,13 +140,6 @@ def test_installPihole_fresh_install_readableFiles(host):
     check_macvendor = test_cmd.format("r", "/etc/pihole/macvendor.db", piholeuser)
     actual_rc = host.run(check_macvendor).rc
     assert exit_status_success == actual_rc
-    # check readable and executable /etc/init.d/pihole-FTL
-    check_init = test_cmd.format("x", "/etc/init.d/pihole-FTL", piholeuser)
-    actual_rc = host.run(check_init).rc
-    assert exit_status_success == actual_rc
-    check_init = test_cmd.format("r", "/etc/init.d/pihole-FTL", piholeuser)
-    actual_rc = host.run(check_init).rc
-    assert exit_status_success == actual_rc
     # check readable and executable manpages
     if maninstalled is True:
         check_man = test_cmd.format("x", "/usr/local/share/man", piholeuser)