Skip to content

Commit fc4bfd1

Browse files
committed
Drop support for CentOS 7 in tests and add RockyLinux 8
Closes #670
1 parent cd16981 commit fc4bfd1

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

images/centos_7/Dockerfile renamed to images/rockylinux8/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM centos:7
1+
FROM rockylinux:8
22

3-
RUN yum -y install openssh-server && yum clean all &&\
3+
RUN dnf -y install openssh-server procps python39 && dnf clean all &&\
44
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do if ! test $i = systemd-tmpfiles-setup.service; then rm -f $i; fi; done) && \
55
rm -f /lib/systemd/system/multi-user.target.wants/* && \
66
rm -f /etc/systemd/system/*.wants/* && \
@@ -17,6 +17,5 @@ RUN yum -y install openssh-server && yum clean all &&\
1717
mkdir -p /root/.ssh && \
1818
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgDryK4AjJeifuc2N54St13KMNlnGLAtibQSMmvSyrhH7XJ1atnBo1HrJhGZNNBVKM67+zYNc9J3fg3qI1g63vSQAA+nXMsDYwu4BPwupakpwJELcGZJxsUGzjGVotVpqPIX5nW8NBGvkVuObI4UELOleq5mQMTGerJO64KkSVi20FDwPJn3q8GG2zk3pESiDA5ShEyFhYC8vOLfSSYD0LYmShAVGCLEgiNb+OXQL6ZRvzqfFEzL0QvaI/l3mb6b0VFPAO4QWOL0xj3cWzOZXOqht3V85CZvSk8ISdNgwCjXLZsPeaYL/toHNvBF30VMrDZ7w4SDU0ZZLEsc/ezxjb" > /root/.ssh/authorized_keys
1919

20-
VOLUME ["/sys/fs/cgroup"]
2120
EXPOSE 22
2221
CMD ["/usr/sbin/init"]

test/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def has_docker():
5656
DOCKER_IMAGES = [
5757
"alpine",
5858
"archlinux",
59-
"centos_7",
59+
"rockylinux8",
6060
"debian_bullseye",
6161
"ubuntu_xenial",
6262
]
@@ -181,7 +181,7 @@ def host(request, tmpdir_factory):
181181
# Wait ssh to be up
182182
service = testinfra.get_host(docker_id, connection="docker").service
183183

184-
images_with_sshd = ("centos_7", "alpine", "archlinux")
184+
images_with_sshd = ("rockylinux8", "alpine", "archlinux")
185185

186186
if image in images_with_sshd:
187187
service_name = "sshd"

test/test_backends.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_ansible_get_hosts():
129129
b"[g1]\n"
130130
b"debian\n"
131131
b"[g2]\n"
132-
b"centos\n"
132+
b"rockylinux\n"
133133
b"[g3:children]\n"
134134
b"g1\n"
135135
b"g2\n"
@@ -142,13 +142,13 @@ def test_ansible_get_hosts():
142142
def get_hosts(spec):
143143
return AnsibleRunner(f.name).get_hosts(spec)
144144

145-
assert get_hosts("all") == ["centos", "debian", "ungrp"]
146-
assert get_hosts("*") == ["centos", "debian", "ungrp"]
145+
assert get_hosts("all") == ["debian", "rockylinux", "ungrp"]
146+
assert get_hosts("*") == ["debian", "rockylinux", "ungrp"]
147147
assert get_hosts("g1") == ["debian"]
148-
assert get_hosts("*2") == ["centos"]
148+
assert get_hosts("*2") == ["rockylinux"]
149149
assert get_hosts("*ia*") == ["debian"]
150-
assert get_hosts("*3") == ["centos", "debian"]
151-
assert get_hosts("*4") == ["centos", "debian"]
150+
assert get_hosts("*3") == ["debian", "rockylinux"]
151+
assert get_hosts("*4") == ["debian", "rockylinux"]
152152
assert get_hosts("ungrouped") == ["ungrp"]
153153
assert get_hosts("un*") == ["ungrp"]
154154
assert get_hosts("nope") == []
@@ -159,7 +159,7 @@ def test_ansible_get_variables():
159159
f.write(
160160
(
161161
b"debian a=b c=d\n"
162-
b"centos e=f\n"
162+
b"rockylinux e=f\n"
163163
b"[all:vars]\n"
164164
b"a=a\n"
165165
b"[g]\n"
@@ -174,9 +174,9 @@ def get_vars(host):
174174
return AnsibleRunner(f.name).get_variables(host)
175175

176176
groups = {
177-
"all": ["centos", "debian"],
177+
"all": ["debian", "rockylinux"],
178178
"g": ["debian"],
179-
"ungrouped": ["centos"],
179+
"ungrouped": ["rockylinux"],
180180
}
181181
assert get_vars("debian") == {
182182
"a": "b",
@@ -186,10 +186,10 @@ def get_vars(host):
186186
"group_names": ["g"],
187187
"groups": groups,
188188
}
189-
assert get_vars("centos") == {
189+
assert get_vars("rockylinux") == {
190190
"a": "a",
191191
"e": "f",
192-
"inventory_hostname": "centos",
192+
"inventory_hostname": "rockylinux",
193193
"group_names": ["ungrouped"],
194194
"groups": groups,
195195
}
@@ -485,12 +485,12 @@ def test_backend_importables():
485485
assert obj.get_connection_type() == connection_type
486486

487487

488-
@pytest.mark.testinfra_hosts("docker://centos_7", "ssh://centos_7")
488+
@pytest.mark.testinfra_hosts("docker://rockylinux8", "ssh://rockylinux8")
489489
def test_docker_encoding(host):
490490
encoding = host.check_output(
491-
"python -c 'import locale;print(locale.getpreferredencoding())'"
491+
"python3 -c 'import locale;print(locale.getpreferredencoding())'"
492492
)
493-
assert encoding == "ANSI_X3.4-1968"
493+
assert encoding == "UTF-8"
494494
string = "ťēꞩƫìṇḟřặ ṧꝕèȃǩ ửƫᵮ8"
495495
assert host.check_output("echo %s | tee /tmp/s.txt", string) == string
496496
assert host.file("/tmp/s.txt").content_string.strip() == string

test/test_modules.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
for image in (
2828
"alpine",
2929
"archlinux",
30-
"centos_7",
30+
"rockylinux8",
3131
"debian_bullseye",
3232
"ubuntu_xenial",
3333
)
@@ -47,7 +47,7 @@ def test_package(host, docker_image):
4747
version = {
4848
"alpine": "8.",
4949
"archlinux": "9.",
50-
"centos_7": "7.",
50+
"rockylinux8": "8.",
5151
"debian_bullseye": "1:8.4",
5252
"ubuntu_xenial": "1:7.2",
5353
}[docker_image]
@@ -56,7 +56,7 @@ def test_package(host, docker_image):
5656
release = {
5757
"alpine": "r3",
5858
"archlinux": None,
59-
"centos_7": ".el7",
59+
"rockylinux8": ".el8",
6060
"debian_bullseye": None,
6161
"ubuntu_xenial": None,
6262
}[docker_image]
@@ -73,7 +73,7 @@ def test_held_package(host):
7373
assert python.version.startswith("3.9.")
7474

7575

76-
@pytest.mark.testinfra_hosts("docker://centos_7")
76+
@pytest.mark.testinfra_hosts("docker://rockylinux8")
7777
def test_non_default_package_tool(host):
7878
# Make non default pkg tool binary present
7979
host.run("install -m a+rx /bin/true /usr/bin/dpkg-query")
@@ -103,7 +103,7 @@ def test_systeminfo(host, docker_image):
103103
release, distribution, codename, arch = {
104104
"alpine": (r"^3\.14\.", "alpine", None, "x86_64"),
105105
"archlinux": ("rolling", "arch", None, "x86_64"),
106-
"centos_7": (r"^7$", "centos", None, "x86_64"),
106+
"rockylinux8": (r"^8.\d+$", "rocky", None, "x86_64"),
107107
"debian_bullseye": (r"^11", "debian", "bullseye", "x86_64"),
108108
"ubuntu_xenial": (r"^16\.04$", "ubuntu", "xenial", "x86_64"),
109109
}[docker_image]
@@ -115,7 +115,7 @@ def test_systeminfo(host, docker_image):
115115

116116
@all_images
117117
def test_ssh_service(host, docker_image):
118-
if docker_image in ("centos_7", "alpine", "archlinux"):
118+
if docker_image in ("rockylinux8", "alpine", "archlinux"):
119119
name = "sshd"
120120
else:
121121
name = "ssh"
@@ -188,6 +188,7 @@ def test_facter(host):
188188
assert host.facter("virtual") in (
189189
{"virtual": "docker"},
190190
{"virtual": "hyperv"}, # github action uses hyperv
191+
{"virtual": "physical"}, # I've this on my machine...
191192
)
192193

193194

@@ -249,7 +250,7 @@ def test_process(host, docker_image):
249250
args, comm = {
250251
"alpine": ("/sbin/init", "init"),
251252
"archlinux": ("/usr/sbin/init", "systemd"),
252-
"centos_7": ("/usr/sbin/init", "systemd"),
253+
"rockylinux8": ("/usr/sbin/init", "systemd"),
253254
"debian_bullseye": ("/sbin/init", "systemd"),
254255
"ubuntu_xenial": ("/sbin/init", "systemd"),
255256
}[docker_image]

testinfra/modules/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def is_installed(self):
3535
- pkg (FreeBSD)
3636
- pkg_info (NetBSD)
3737
- pkg_info (OpenBSD)
38-
- rpm (RHEL, Centos, Fedora, ...)
38+
- rpm (RHEL, RockyLinux, Fedora, ...)
3939
"""
4040
raise NotImplementedError
4141

0 commit comments

Comments
 (0)