mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-07-31 01:24:17 +02:00
Adjust test to mock PID1 to be systemd
Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
parent
137338e6a8
commit
f3166d7a78
@ -1,7 +1,7 @@
|
|||||||
FROM quay.io/centos/centos:stream10
|
FROM quay.io/centos/centos:stream10
|
||||||
# Disable SELinux
|
# Disable SELinux
|
||||||
RUN echo "SELINUX=disabled" > /etc/selinux/config
|
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 GITDIR=/etc/.pihole
|
||||||
ENV SCRIPTDIR=/opt/pihole
|
ENV SCRIPTDIR=/opt/pihole
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
FROM quay.io/centos/centos:stream9
|
FROM quay.io/centos/centos:stream9
|
||||||
# Disable SELinux
|
# Disable SELinux
|
||||||
RUN echo "SELINUX=disabled" > /etc/selinux/config
|
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 GITDIR=/etc/.pihole
|
||||||
ENV SCRIPTDIR=/opt/pihole
|
ENV SCRIPTDIR=/opt/pihole
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
FROM fedora:40
|
FROM fedora:40
|
||||||
RUN dnf install -y git initscripts
|
RUN dnf install -y git
|
||||||
|
|
||||||
ENV GITDIR=/etc/.pihole
|
ENV GITDIR=/etc/.pihole
|
||||||
ENV SCRIPTDIR=/opt/pihole
|
ENV SCRIPTDIR=/opt/pihole
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
FROM fedora:41
|
FROM fedora:41
|
||||||
RUN dnf install -y git initscripts
|
RUN dnf install -y git
|
||||||
|
|
||||||
ENV GITDIR=/etc/.pihole
|
ENV GITDIR=/etc/.pihole
|
||||||
ENV SCRIPTDIR=/opt/pihole
|
ENV SCRIPTDIR=/opt/pihole
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
FROM fedora:42
|
FROM fedora:42
|
||||||
RUN dnf install -y git initscripts
|
RUN dnf install -y git
|
||||||
|
|
||||||
ENV GITDIR=/etc/.pihole
|
ENV GITDIR=/etc/.pihole
|
||||||
ENV SCRIPTDIR=/opt/pihole
|
ENV SCRIPTDIR=/opt/pihole
|
||||||
|
@ -66,6 +66,14 @@ def test_installPihole_fresh_install_readableFiles(host):
|
|||||||
mock_command("dialog", {"*": ("", "0")}, host)
|
mock_command("dialog", {"*": ("", "0")}, host)
|
||||||
# mock git pull
|
# mock git pull
|
||||||
mock_command_passthrough("git", {"pull": ("", "0")}, host)
|
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 systemctl to not start FTL
|
||||||
mock_command_2(
|
mock_command_2(
|
||||||
"systemctl",
|
"systemctl",
|
||||||
@ -73,6 +81,7 @@ def test_installPihole_fresh_install_readableFiles(host):
|
|||||||
"enable pihole-FTL": ("", "0"),
|
"enable pihole-FTL": ("", "0"),
|
||||||
"restart pihole-FTL": ("", "0"),
|
"restart pihole-FTL": ("", "0"),
|
||||||
"start pihole-FTL": ("", "0"),
|
"start pihole-FTL": ("", "0"),
|
||||||
|
"stop pihole-FTL": ("", "0"),
|
||||||
"*": ('echo "systemctl call with $@"', "0"),
|
"*": ('echo "systemctl call with $@"', "0"),
|
||||||
},
|
},
|
||||||
host,
|
host,
|
||||||
@ -131,13 +140,6 @@ def test_installPihole_fresh_install_readableFiles(host):
|
|||||||
check_macvendor = test_cmd.format("r", "/etc/pihole/macvendor.db", piholeuser)
|
check_macvendor = test_cmd.format("r", "/etc/pihole/macvendor.db", piholeuser)
|
||||||
actual_rc = host.run(check_macvendor).rc
|
actual_rc = host.run(check_macvendor).rc
|
||||||
assert exit_status_success == actual_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
|
# check readable and executable manpages
|
||||||
if maninstalled is True:
|
if maninstalled is True:
|
||||||
check_man = test_cmd.format("x", "/usr/local/share/man", piholeuser)
|
check_man = test_cmd.format("x", "/usr/local/share/man", piholeuser)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user