Skip to content

Commit eec71f4

Browse files
committed
Update CI images to use debian bullseye and alpine 3.14
1 parent 05df015 commit eec71f4

File tree

6 files changed

+72
-75
lines changed

6 files changed

+72
-75
lines changed

images/alpine/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM alpine:3.11
1+
FROM alpine:3.14
22

3-
RUN apk add --update --no-cache python openrc openssh && \
3+
RUN apk add --update --no-cache python3 openrc openssh && \
44
sed -i "s/^#PermitRootLogin prohibit-password/PermitRootLogin without-password/g" /etc/ssh/sshd_config && \
55
rm -f /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_rsa_key && \
66
ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_ecdsa_key && \

images/debian_buster/Dockerfile renamed to images/debian_bullseye/Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM debian:buster
1+
FROM debian:bullseye
22

33
ENV container docker
44

55
# ntpd is linked to /bin/false, so the service is not running but is enabled
66
RUN apt-get update && \
77
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
88
lsb-release \
9-
python \
9+
python3 \
1010
openssh-server \
1111
puppet \
1212
salt-minion \
@@ -15,8 +15,9 @@ RUN apt-get update && \
1515
sudo \
1616
supervisor \
1717
systemd-sysv \
18-
python-pip \
19-
python-virtualenv \
18+
virtualenv \
19+
iproute2 \
20+
iputils-ping \
2021
iptables \
2122
iptables-persistent && \
2223
rm -rf /var/lib/apt/lists/*
@@ -33,7 +34,7 @@ RUN mkdir -p /var/run/sshd && \
3334
systemctl enable supervisor.service && \
3435
systemctl enable netfilter-persistent.service && \
3536
ln -fsn /bin/false /usr/sbin/ntpd && \
36-
echo "python hold" | dpkg --set-selections && \
37+
echo "python3 hold" | dpkg --set-selections && \
3738
echo "LANG=fr_FR.ISO-8859-15" > /etc/default/locale && \
3839
echo "LANGUAGE=fr_FR" >> /etc/default/locale && \
3940
echo "fr_FR.ISO-8859-15 ISO-8859-15" >> /etc/locale.gen && \
@@ -65,8 +66,8 @@ RUN echo "*nat\n:PREROUTING ACCEPT [0:0]\n:INPUT ACCEPT [0:0]\n:OUTPUT ACCEPT [0
6566
# Expiration date for user "user"
6667
RUN chage -E 20000 user
6768

68-
# Some python virtualenv
69-
RUN python -m virtualenv /v && /v/bin/pip install 'pytest>2,<3'
69+
# Some python3 virtualenv
70+
RUN virtualenv /v && /v/bin/pip install 'pytest>5,<6'
7071

7172
ENV LANG fr_FR.ISO-8859-15
7273
ENV LANGUAGE fr_FR

test/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def has_docker():
5858
"alpine",
5959
"archlinux",
6060
"centos_7",
61-
"debian_buster",
61+
"debian_bullseye",
6262
"ubuntu_xenial",
6363
]
6464

@@ -215,7 +215,7 @@ def pytest_generate_tests(metafunc):
215215
break
216216
else:
217217
# Default
218-
hosts = ["docker://debian_buster"]
218+
hosts = ["docker://debian_bullseye"]
219219
metafunc.parametrize("host", hosts, indirect=True, scope="function")
220220

221221

test/test_backends.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,36 @@
2323
from testinfra.utils.ansible_runner import AnsibleRunner
2424

2525
HOSTS = [
26-
"ssh://debian_buster",
27-
"safe-ssh://debian_buster",
28-
"docker://debian_buster",
29-
"paramiko://debian_buster",
30-
"ansible://debian_buster",
31-
"ansible://debian_buster?force_ansible=True",
26+
"ssh://debian_bullseye",
27+
"safe-ssh://debian_bullseye",
28+
"docker://debian_bullseye",
29+
"paramiko://debian_bullseye",
30+
"ansible://debian_bullseye",
31+
"ansible://debian_bullseye?force_ansible=True",
3232
]
3333
USER_HOSTS = [
34-
"ssh://user@debian_buster",
35-
"safe-ssh://user@debian_buster",
36-
"docker://user@debian_buster",
37-
"paramiko://user@debian_buster",
38-
"ansible://user@debian_buster",
39-
"ansible://user@debian_buster?force_ansible=True",
34+
"ssh://user@debian_bullseye",
35+
"safe-ssh://user@debian_bullseye",
36+
"docker://user@debian_bullseye",
37+
"paramiko://user@debian_bullseye",
38+
"ansible://user@debian_bullseye",
39+
"ansible://user@debian_bullseye?force_ansible=True",
4040
]
4141
SUDO_HOSTS = [
42-
"ssh://user@debian_buster?sudo=True",
43-
"safe-ssh://user@debian_buster?sudo=True",
44-
"docker://user@debian_buster?sudo=True",
45-
"paramiko://user@debian_buster?sudo=True",
46-
"ansible://user@debian_buster?sudo=True",
47-
"ansible://user@debian_buster?force_ansible=True&sudo=True",
42+
"ssh://user@debian_bullseye?sudo=True",
43+
"safe-ssh://user@debian_bullseye?sudo=True",
44+
"docker://user@debian_bullseye?sudo=True",
45+
"paramiko://user@debian_bullseye?sudo=True",
46+
"ansible://user@debian_bullseye?sudo=True",
47+
"ansible://user@debian_bullseye?force_ansible=True&sudo=True",
4848
]
4949
SUDO_USER_HOSTS = [
50-
"ssh://debian_buster?sudo=True&sudo_user=user",
51-
"safe-ssh://debian_buster?sudo=True&sudo_user=user",
52-
"docker://debian_buster?sudo=True&sudo_user=user",
53-
"paramiko://debian_buster?sudo=True&sudo_user=user",
54-
"ansible://debian_buster?sudo=True&sudo_user=user",
55-
"ansible://debian_buster?force_ansible=True&sudo=True&sudo_user=user",
50+
"ssh://debian_bullseye?sudo=True&sudo_user=user",
51+
"safe-ssh://debian_bullseye?sudo=True&sudo_user=user",
52+
"docker://debian_bullseye?sudo=True&sudo_user=user",
53+
"paramiko://debian_bullseye?sudo=True&sudo_user=user",
54+
"ansible://debian_bullseye?sudo=True&sudo_user=user",
55+
"ansible://debian_bullseye?force_ansible=True&sudo=True&sudo_user=user",
5656
]
5757

5858

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

7676
@pytest.mark.testinfra_hosts(*HOSTS)
7777
def test_encoding(host):
78-
# buster image is fr_FR@ISO-8859-15
78+
# bullseye image is fr_FR@ISO-8859-15
7979
cmd = host.run("ls -l %s", "/é")
8080
if host.backend.get_connection_type() == "docker":
8181
# docker bug ?
@@ -99,7 +99,7 @@ def test_encoding(host):
9999
)
100100

101101

102-
@pytest.mark.testinfra_hosts("ansible://debian_buster?force_ansible=True")
102+
@pytest.mark.testinfra_hosts("ansible://debian_bullseye?force_ansible=True")
103103
def test_ansible_any_error_fatal(host):
104104
os.environ["ANSIBLE_ANY_ERRORS_FATAL"] = "True"
105105
try:

test/test_modules.py

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"alpine",
3232
"archlinux",
3333
"centos_7",
34-
"debian_buster",
34+
"debian_bullseye",
3535
"ubuntu_xenial",
3636
)
3737
]
@@ -51,16 +51,16 @@ def test_package(host, docker_image):
5151
"alpine": "8.",
5252
"archlinux": "8.",
5353
"centos_7": "7.",
54-
"debian_buster": "1:7.9",
54+
"debian_bullseye": "1:8.4",
5555
"ubuntu_xenial": "1:7.2",
5656
}[docker_image]
5757
assert ssh.is_installed
5858
assert ssh.version.startswith(version)
5959
release = {
60-
"alpine": "r0",
60+
"alpine": "r2",
6161
"archlinux": None,
6262
"centos_7": ".el7",
63-
"debian_buster": None,
63+
"debian_bullseye": None,
6464
"ubuntu_xenial": None,
6565
}[docker_image]
6666
if release is None:
@@ -71,9 +71,9 @@ def test_package(host, docker_image):
7171

7272

7373
def test_held_package(host):
74-
python = host.package("python")
74+
python = host.package("python3")
7575
assert python.is_installed
76-
assert python.version.startswith("2.7.")
76+
assert python.version.startswith("3.9.")
7777

7878

7979
@pytest.mark.testinfra_hosts("docker://centos_7")
@@ -95,7 +95,7 @@ def test_uninstalled_package_version(host):
9595
host.package("sudo").version
9696
assert (
9797
"The package sudo is not installed, dpkg-query output: "
98-
"deinstall ok config-files 1.8."
98+
"deinstall ok config-files 1.9."
9999
) in str(excinfo.value)
100100

101101

@@ -104,10 +104,10 @@ def test_systeminfo(host, docker_image):
104104
assert host.system_info.type == "linux"
105105

106106
release, distribution, codename, arch = {
107-
"alpine": (r"^3\.11\.", "alpine", None, "x86_64"),
107+
"alpine": (r"^3\.14\.", "alpine", None, "x86_64"),
108108
"archlinux": ("rolling", "arch", None, "x86_64"),
109109
"centos_7": (r"^7$", "centos", None, "x86_64"),
110-
"debian_buster": (r"^10", "debian", "buster", "x86_64"),
110+
"debian_bullseye": (r"^11", "debian", "bullseye", "x86_64"),
111111
"ubuntu_xenial": (r"^16\.04$", "ubuntu", "xenial", "x86_64"),
112112
}[docker_image]
113113

@@ -178,16 +178,16 @@ def test_service(host, name, running, enabled):
178178

179179
def test_salt(host):
180180
ssh_version = host.salt("pkg.version", "openssh-server", local=True)
181-
assert ssh_version.startswith("1:7.9")
181+
assert ssh_version.startswith("1:8.4")
182182

183183

184184
def test_puppet_resource(host):
185185
resource = host.puppet_resource("package", "openssh-server")
186-
assert resource["openssh-server"]["ensure"].startswith("1:7.9")
186+
assert resource["openssh-server"]["ensure"].startswith("1:8.4")
187187

188188

189189
def test_facter(host):
190-
assert host.facter()["os"]["distro"]["codename"] == "buster"
190+
assert host.facter()["os"]["distro"]["codename"] == "bullseye"
191191
assert host.facter("virtual") in (
192192
{"virtual": "docker"},
193193
{"virtual": "hyperv"}, # github action uses hyperv
@@ -253,7 +253,7 @@ def test_process(host, docker_image):
253253
"alpine": ("/sbin/init", "init"),
254254
"archlinux": ("/usr/sbin/init", "systemd"),
255255
"centos_7": ("/usr/sbin/init", "systemd"),
256-
"debian_buster": ("/sbin/init", "systemd"),
256+
"debian_bullseye": ("/sbin/init", "systemd"),
257257
"ubuntu_xenial": ("/sbin/init", "systemd"),
258258
}[docker_image]
259259
assert init.args == args
@@ -264,7 +264,7 @@ def test_user(host):
264264
user = host.user("sshd")
265265
assert user.exists
266266
assert user.name == "sshd"
267-
assert user.uid == 105
267+
assert user.uid == 104
268268
assert user.gid == 65534
269269
assert user.group == "nogroup"
270270
assert user.gids == [65534]
@@ -359,10 +359,10 @@ def test_ansible_unavailable(host):
359359
assert expected in str(excinfo.value)
360360

361361

362-
@pytest.mark.testinfra_hosts("ansible://debian_buster")
362+
@pytest.mark.testinfra_hosts("ansible://debian_bullseye")
363363
def test_ansible_module(host):
364364
setup = host.ansible("setup")["ansible_facts"]
365-
assert setup["ansible_lsb"]["codename"] == "buster"
365+
assert setup["ansible_lsb"]["codename"] == "bullseye"
366366
passwd = host.ansible("file", "path=/etc/passwd state=file")
367367
assert passwd["changed"] is False
368368
assert passwd["gid"] == 0
@@ -379,11 +379,11 @@ def test_ansible_module(host):
379379
assert variables["myvar"] == "foo"
380380
assert variables["myhostvar"] == "bar"
381381
assert variables["mygroupvar"] == "qux"
382-
assert variables["inventory_hostname"] == "debian_buster"
382+
assert variables["inventory_hostname"] == "debian_bullseye"
383383
assert variables["group_names"] == ["testgroup"]
384384
assert variables["groups"] == {
385-
"all": ["debian_buster"],
386-
"testgroup": ["debian_buster"],
385+
"all": ["debian_bullseye"],
386+
"testgroup": ["debian_bullseye"],
387387
}
388388

389389
with pytest.raises(host.ansible.AnsibleException) as excinfo:
@@ -394,14 +394,16 @@ def test_ansible_module(host):
394394
host.ansible("command", "zzz", check=False)
395395
except host.ansible.AnsibleException as exc:
396396
assert exc.result["rc"] == 2
397-
# notez que the debian buster container is set to LANG=fr_FR
397+
# notez que the debian bullseye container is set to LANG=fr_FR
398398
assert exc.result["msg"] == ("[Errno 2] Aucun fichier ou dossier " "de ce type")
399399

400400
result = host.ansible("command", "echo foo", check=False)
401401
assert result["stdout"] == "foo"
402402

403403

404-
@pytest.mark.testinfra_hosts("ansible://debian_buster", "ansible://user@debian_buster")
404+
@pytest.mark.testinfra_hosts(
405+
"ansible://debian_bullseye", "ansible://user@debian_bullseye"
406+
)
405407
def test_ansible_module_become(host):
406408
user_name = host.user().name
407409
assert host.ansible("shell", "echo $USER", check=False)["stdout"] == user_name
@@ -419,7 +421,7 @@ def test_ansible_module_become(host):
419421
)
420422

421423

422-
@pytest.mark.testinfra_hosts("ansible://debian_buster")
424+
@pytest.mark.testinfra_hosts("ansible://debian_bullseye")
423425
def test_ansible_module_options(host):
424426
assert (
425427
host.ansible(
@@ -532,7 +534,7 @@ def test_sudo_fail_from_root(host):
532534
assert host.user().name == "root"
533535

534536

535-
@pytest.mark.testinfra_hosts("docker://user@debian_buster")
537+
@pytest.mark.testinfra_hosts("docker://user@debian_bullseye")
536538
def test_sudo_to_root(host):
537539
assert host.user().name == "user"
538540
with host.sudo():
@@ -550,9 +552,9 @@ def test_command_execution(host):
550552

551553
def test_pip_package(host):
552554
with pytest.warns(DeprecationWarning):
553-
assert host.pip_package.get_packages()["pip"]["version"] == "18.1"
555+
assert host.pip_package.get_packages()["pip"]["version"] == "20.3.4"
554556
pytest_package = host.pip_package.get_packages(pip_path="/v/bin/pip")["pytest"]
555-
assert pytest_package["version"].startswith("2.")
557+
assert pytest_package["version"].startswith("5.")
556558
with pytest.warns(DeprecationWarning):
557559
outdated = host.pip_package.get_outdated_packages(pip_path="/v/bin/pip")[
558560
"pytest"
@@ -565,13 +567,13 @@ def test_pip_package(host):
565567

566568
def test_pip(host):
567569
# get_packages
568-
assert host.pip.get_packages()["pip"]["version"] == "18.1"
570+
assert host.pip.get_packages()["pip"]["version"] == "20.3.4"
569571
pytest_package = host.pip.get_packages(pip_path="/v/bin/pip")["pytest"]
570-
assert pytest_package["version"].startswith("2.")
572+
assert pytest_package["version"].startswith("5.")
571573
# outdated
572574
outdated = host.pip.get_outdated_packages(pip_path="/v/bin/pip")["pytest"]
573575
assert outdated["current"] == pytest_package["version"]
574-
assert int(outdated["latest"].split(".")[0]) > 2
576+
assert int(outdated["latest"].split(".")[0]) >= 6
575577
# check
576578
assert host.pip.check().succeeded
577579
# is_installed
@@ -580,8 +582,8 @@ def test_pip(host):
580582
pytest_package = host.pip("pytest", pip_path="/v/bin/pip")
581583
assert pytest_package.is_installed
582584
# version
583-
assert host.pip("pip").version == "18.1"
584-
assert pytest_package.version.startswith("2.")
585+
assert host.pip("pip").version == "20.3.4"
586+
assert pytest_package.version.startswith("5.")
585587
assert host.pip("does_not_exist").version == ""
586588

587589

@@ -667,16 +669,10 @@ def test_addr(host):
667669
assert isinstance(ip_address(ip), (IPv4Address, IPv6Address))
668670

669671

670-
@pytest.mark.testinfra_hosts("ansible://debian_buster")
672+
@pytest.mark.testinfra_hosts("ansible://debian_bullseye")
671673
def test_addr_namespace(host):
672674
namespace_lookup = host.addr("localhost", "ns1")
673-
# ns1 network namespace does not exist so everything is false
674675
assert not namespace_lookup.namespace_exists
675-
assert not namespace_lookup.is_reachable
676-
assert not namespace_lookup.is_resolvable
677-
with pytest.raises(NotImplementedError):
678-
# nc is not available so an error is raised
679-
assert not namespace_lookup.port("443").is_reachable
680676

681677

682678
@pytest.mark.parametrize(

testinfra/modules/systeminfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def codename(self):
164164
"""Release code name
165165
166166
>>> host.system_info.codename
167-
'buster'
167+
'bullseye'
168168
"""
169169
return self.sysinfo["codename"]
170170

0 commit comments

Comments
 (0)