Skip to content

Commit

Permalink
Update test images to rockylinux 9 and debian bookworm
Browse files Browse the repository at this point in the history
  • Loading branch information
philpep committed Jul 21, 2023
1 parent eb266ac commit 8e5336e
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 100 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
FROM debian:bullseye
FROM debian:bookworm

ENV container docker

# ntpd is linked to /bin/false, so the service is not running but is enabled
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
lsb-release \
python3 \
python3-pip \
openssh-server \
puppet \
salt-minion \
locales \
ntp \
sudo \
supervisor \
systemd-sysv \
Expand All @@ -29,11 +26,8 @@ RUN mkdir -p /var/run/sshd && \
rm -f /lib/systemd/system/sockets.target.wants/*udev* && \
rm -f /lib/systemd/system/sockets.target.wants/*initctl* && \
systemctl enable ssh.service && \
systemctl disable salt-minion.service && \
systemctl enable ntp.service && \
systemctl enable supervisor.service && \
systemctl enable netfilter-persistent.service && \
ln -fsn /bin/false /usr/sbin/ntpd && \
echo "python3 hold" | dpkg --set-selections && \
echo "LANG=fr_FR.ISO-8859-15" > /etc/default/locale && \
echo "LANGUAGE=fr_FR" >> /etc/default/locale && \
Expand Down Expand Up @@ -69,7 +63,10 @@ RUN chage -E 20000 -m 7 -M 90 user
# Some python3 virtualenv
RUN virtualenv /v
RUN /v/bin/pip install -U pip
RUN /v/bin/pip install 'requests>1,<2'
RUN /v/bin/pip install 'requests==2.30.0'

# install salt
RUN python3 -m pip install --break-system-packages --no-cache salt

ENV LANG fr_FR.ISO-8859-15
ENV LANGUAGE fr_FR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM rockylinux:8
FROM rockylinux:9

RUN dnf -y install openssh-server procps python39 && dnf clean all &&\
RUN dnf -y install openssh-server procps python311 iputils && dnf clean all &&\
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do if ! test $i = systemd-tmpfiles-setup.service; then rm -f $i; fi; done) && \
rm -f /lib/systemd/system/multi-user.target.wants/* && \
rm -f /etc/systemd/system/*.wants/* && \
Expand Down
8 changes: 4 additions & 4 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def has_docker():
"""

DOCKER_IMAGES = [
"rockylinux8",
"debian_bullseye",
"rockylinux9",
"debian_bookworm",
]


Expand Down Expand Up @@ -184,7 +184,7 @@ def host(request, tmpdir_factory):
# Wait ssh to be up
service = testinfra.get_host(docker_id, connection="docker").service

if image == "rockylinux8":
if image == "rockylinux9":
service_name = "sshd"
else:
service_name = "ssh"
Expand Down Expand Up @@ -215,7 +215,7 @@ def pytest_generate_tests(metafunc):
break
else:
# Default
hosts = ["docker://debian_bullseye"]
hosts = ["docker://debian_bookworm"]
metafunc.parametrize("host", hosts, indirect=True, scope="function")


Expand Down
54 changes: 27 additions & 27 deletions test/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,36 @@
from testinfra.utils.ansible_runner import AnsibleRunner

HOSTS = [
"ssh://debian_bullseye",
"safe-ssh://debian_bullseye",
"docker://debian_bullseye",
"paramiko://debian_bullseye",
"ansible://debian_bullseye",
"ansible://debian_bullseye?force_ansible=True",
"ssh://debian_bookworm",
"safe-ssh://debian_bookworm",
"docker://debian_bookworm",
"paramiko://debian_bookworm",
"ansible://debian_bookworm",
"ansible://debian_bookworm?force_ansible=True",
]
USER_HOSTS = [
"ssh://user@debian_bullseye",
"safe-ssh://user@debian_bullseye",
"docker://user@debian_bullseye",
"paramiko://user@debian_bullseye",
"ansible://user@debian_bullseye",
"ansible://user@debian_bullseye?force_ansible=True",
"ssh://user@debian_bookworm",
"safe-ssh://user@debian_bookworm",
"docker://user@debian_bookworm",
"paramiko://user@debian_bookworm",
"ansible://user@debian_bookworm",
"ansible://user@debian_bookworm?force_ansible=True",
]
SUDO_HOSTS = [
"ssh://user@debian_bullseye?sudo=True",
"safe-ssh://user@debian_bullseye?sudo=True",
"docker://user@debian_bullseye?sudo=True",
"paramiko://user@debian_bullseye?sudo=True",
"ansible://user@debian_bullseye?sudo=True",
"ansible://user@debian_bullseye?force_ansible=True&sudo=True",
"ssh://user@debian_bookworm?sudo=True",
"safe-ssh://user@debian_bookworm?sudo=True",
"docker://user@debian_bookworm?sudo=True",
"paramiko://user@debian_bookworm?sudo=True",
"ansible://user@debian_bookworm?sudo=True",
"ansible://user@debian_bookworm?force_ansible=True&sudo=True",
]
SUDO_USER_HOSTS = [
"ssh://debian_bullseye?sudo=True&sudo_user=user",
"safe-ssh://debian_bullseye?sudo=True&sudo_user=user",
"docker://debian_bullseye?sudo=True&sudo_user=user",
"paramiko://debian_bullseye?sudo=True&sudo_user=user",
"ansible://debian_bullseye?sudo=True&sudo_user=user",
"ansible://debian_bullseye?force_ansible=True&sudo=True&sudo_user=user",
"ssh://debian_bookworm?sudo=True&sudo_user=user",
"safe-ssh://debian_bookworm?sudo=True&sudo_user=user",
"docker://debian_bookworm?sudo=True&sudo_user=user",
"paramiko://debian_bookworm?sudo=True&sudo_user=user",
"ansible://debian_bookworm?sudo=True&sudo_user=user",
"ansible://debian_bookworm?force_ansible=True&sudo=True&sudo_user=user",
]


Expand All @@ -75,7 +75,7 @@ def test_command(host):

@pytest.mark.testinfra_hosts(*HOSTS)
def test_encoding(host):
# bullseye image is fr_FR@ISO-8859-15
# bookworm image is fr_FR@ISO-8859-15
cmd = host.run("ls -l %s", "/é")
if host.backend.get_connection_type() == "docker":
# docker bug ?
Expand All @@ -99,7 +99,7 @@ def test_encoding(host):
)


@pytest.mark.testinfra_hosts("ansible://debian_bullseye?force_ansible=True")
@pytest.mark.testinfra_hosts("ansible://debian_bookworm?force_ansible=True")
def test_ansible_any_error_fatal(host):
os.environ["ANSIBLE_ANY_ERRORS_FATAL"] = "True"
try:
Expand Down Expand Up @@ -485,7 +485,7 @@ def test_backend_importables():
assert obj.get_connection_type() == connection_type


@pytest.mark.testinfra_hosts("docker://rockylinux8", "ssh://rockylinux8")
@pytest.mark.testinfra_hosts("docker://rockylinux9", "ssh://rockylinux9")
def test_docker_encoding(host):
encoding = host.check_output(
"python3 -c 'import locale;print(locale.getpreferredencoding())'"
Expand Down
Loading

1 comment on commit 8e5336e

@nuzulul43
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.