From bddb697ff2d6337399dec6cf54e93c8771f67634 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 26 Oct 2023 11:59:40 +0200 Subject: [PATCH] test: Generalize RHEL 8 special cases This prepares our tests for moving to rhel-8-10. --- test/README.md | 4 ++-- test/verify/check-connection | 2 +- test/verify/check-metrics | 6 +++--- test/verify/check-system-info | 6 +++--- test/verify/check-system-services | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/README.md b/test/README.md index 4f069c4f216..b75c5b1a4e9 100644 --- a/test/README.md +++ b/test/README.md @@ -162,8 +162,8 @@ You can set these environment variables to configure the test suite: "fedora-39" "fedora-coreos" "fedora-testing" - "rhel-8-9" - "rhel-8-9-distropkg" + "rhel-8-10" + "rhel-8-10-distropkg" "rhel-9-3" "rhel4edge", "ubuntu-2204" diff --git a/test/verify/check-connection b/test/verify/check-connection index e8fdc6c3a07..58f7a009b23 100755 --- a/test/verify/check-connection +++ b/test/verify/check-connection @@ -605,7 +605,7 @@ class TestConnection(testlib.MachineCase): def checkMotdContent(string, expected=True): # Needs https://github.com/linux-pam/linux-pam/pull/292 (or PAM 1.5.0) - old_pam = (m.image in ['centos-8-stream', 'ubuntu-2204', 'rhel-8-7', 'rhel-8-8', 'rhel-8-9']) + old_pam = m.image.startswith('rhel-8-') or m.image in ['centos-8-stream', 'ubuntu-2204'] # check issue (should be exactly the same as motd) assertInOrNot(string, m.execute("cat /etc/issue.d/cockpit.issue"), expected) diff --git a/test/verify/check-metrics b/test/verify/check-metrics index df3d52b8802..5520219b53b 100755 --- a/test/verify/check-metrics +++ b/test/verify/check-metrics @@ -456,7 +456,7 @@ class TestHistoryMetrics(testlib.MachineCase): # Journal was recorded on Fedora 33 and when trying to use it with older systemd it fails with: # `Journal file /var/log/journal/*/journal.journal uses an unsupported feature, ignoring file.` - if self.machine.image in ["centos-8-stream", "rhel-8-7", "rhel-8-8", "rhel-8-9"]: + if self.machine.image == "centos-8-stream" or self.machine.image.startswith("rhel-8-"): return m.upload(["verify/files/metrics-archives/journal.journal.gz"], "/tmp") @@ -988,7 +988,7 @@ class TestCurrentMetrics(testlib.MachineCase): # Test link to user services # older releases don't have CPU accounting enabled for user services - if m.image not in ["rhel-8-7", "rhel-8-8", "rhel-8-9", "centos-8-stream"]: + if self.machine.image != "centos-8-stream" and not self.machine.image.startswith("rhel-8-"): m.execute("su - admin -c 'XDG_RUNTIME_DIR=/run/user/$(id -u admin) systemd-run --user --collect --slice cockpittest -p CPUQuota=60% --unit cpu-userhog dd if=/dev/urandom of=/dev/null'") # user services are always running underneath user@1000.service, so these two will compete for row 1 or 2 b.wait_in_text("table[aria-label='Top 5 CPU services'] tbody", "cpu-userhog") @@ -1105,7 +1105,7 @@ BEGIN {{ # Test link to user services # older releases don't have memory accounting enabled for user services - if m.image not in ["rhel-8-7", "rhel-8-8", "rhel-8-9", "centos-8-stream"]: + if m.image != "centos-8-stream" and not m.image.startswith("rhel-8"): m.execute("su - admin -c 'XDG_RUNTIME_DIR=/run/user/$(id -u admin) systemd-run --user --collect --slice cockpittest --unit mem-userhog memhog.sh'") m.execute("while [ ! -e /tmp/hogged ]; do sleep 1; done") # user services are always running underneath user@1000.service, so these two will compete for row 1 or 2 diff --git a/test/verify/check-system-info b/test/verify/check-system-info index aa3cd3fb954..808449e80a3 100755 --- a/test/verify/check-system-info +++ b/test/verify/check-system-info @@ -685,12 +685,12 @@ machine : 8561 b.reload() b.enter_page('/system/hwinfo') - distros_without_systemd_memory_dmi = ['rhel-8-7', 'rhel-8-8', 'rhel-8-9', 'centos-8-stream'] + distro_without_systemd_memory_dmi = m.image == 'centos-8-stream' or m.image.startswith('rhel-8-') # Test more specific memory data with a fake dmidecode b.wait_in_text('#memory-listing tbody:nth-of-type(1) td[data-label=ID]', "BANK 0: ChannelA-DIMM0") b.wait_in_text('#memory-listing tbody:nth-of-type(1) td[data-label=Type]', "DDR4") - if m.image in distros_without_systemd_memory_dmi: + if distro_without_systemd_memory_dmi: b.wait_in_text('#memory-listing tbody:nth-of-type(1) td[data-label=Size]', "4 GB") else: b.wait_in_text('#memory-listing tbody:nth-of-type(1) td[data-label=Size]', "4 GiB") @@ -701,7 +701,7 @@ machine : 8561 b.wait_in_text('#memory-listing tbody:nth-of-type(2) td[data-label=ID]', "BANK 2: ChannelB-DIMM0") b.wait_in_text('#memory-listing tbody:nth-of-type(2) td[data-label=Type]', "DDR4") - if m.image in distros_without_systemd_memory_dmi: + if distro_without_systemd_memory_dmi: b.wait_in_text('#memory-listing tbody:nth-of-type(1) td[data-label=Size]', "4 GB") else: b.wait_in_text('#memory-listing tbody:nth-of-type(1) td[data-label=Size]', "4 GiB") diff --git a/test/verify/check-system-services b/test/verify/check-system-services index 7800314664f..78af0318229 100755 --- a/test/verify/check-system-services +++ b/test/verify/check-system-services @@ -647,7 +647,7 @@ ExecStart=/bin/awk -f /tmp/mem-hog{params}.awk self.goto_service("mem-hog.service") b.wait_not_present("#memory") # In some distros systemctl is showing memory current as [Not Set] for user units - if not user or m.image not in ["rhel-8-7", "rhel-8-8", "rhel-8-9", "centos-8-stream"]: + if not user or (m.image != "centos-8-stream" and not m.image.startswith("rhel-8-")): self.run_systemctl(user, "start mem-hog.service") # If the test fails before we stop mem-hog, the next test run will not get the correct memory usage here self.addCleanup(self.run_systemctl, user, "stop mem-hog.service || true")