Skip to content

Commit

Permalink
Merge pull request #441 from libhe/master
Browse files Browse the repository at this point in the history
Update test_check_partitions,check_etc_default_grub,test_check_boot_p…
  • Loading branch information
libhe authored Sep 24, 2024
2 parents f705a5d + 7a2fd7d commit 9686d1c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions os_tests/tests/test_rhel_guest_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def test_check_partitions(self):
if re.search(dev_name, line):
count = count + 1
product_id = utils_lib.get_product_id(self)
if float(product_id) >= 9.0:
if float(product_id) >= 10.0:
expected_partitions = 4
elif float(product_id) >= 9.0:
expected_partitions = 5
if utils_lib.is_arch(self, arch='s390x'):
expected_partitions = 3
Expand Down Expand Up @@ -141,7 +143,7 @@ def test_check_boot_partition_guid(self):
N/A
"""
product_id = utils_lib.get_product_id(self)
if float(product_id) >= 9.0 and (
if float(product_id) >= 9.0 and float(product_id) < 10.0 and (
utils_lib.is_arch(self, arch='aarch64')
or utils_lib.is_arch(self, arch='x86_64')):
cmd = "lsblk -n -o PARTTYPE,MOUNTPOINT | grep '/boot$'"
Expand All @@ -153,7 +155,7 @@ def test_check_boot_partition_guid(self):
"Boot partition GUID incorrect: %s" % output)
else:
self.skipTest(
"Only run on RHEL 9.x or later on x86_64 or aarch64.")
"Only run on RHEL 9.x on x86_64 or aarch64.")

def test_check_etc_sysconfig_kernel(self):
"""
Expand Down Expand Up @@ -246,6 +248,9 @@ def test_check_etc_default_grub(self):
self.assertNotEqual(
testline, "", "GRUB_CMDLINE_LINUX is not set in /etc/default/grub")
for line in lines:
# For RHEL 10 and later, skip the check for 'net.ifnames=0'
if line == "net.ifnames=0" and x >= 10:
continue
self.assertIn(line, testline,
"%s is not in GRUB_CMDLINE_LINUX" % line)

Expand Down Expand Up @@ -662,15 +667,15 @@ def test_check_boot_cmdline_parameters(self):
cmd,
expect_ret=0,
msg="cat /proc/cmdline")
# crashkernel
product_id = utils_lib.get_product_id(self)
for line in lines:
if line == "net.ifnames=0" and float(product_id) >= 10.0:
# Skip the check for net.ifnames=0 if the product is RHEL 10 or higher
self.log.info("Skipping check for net.ifnames=0 as it is removed in RHEL 10 and later")
continue
self.assertIn(line, output, "%s is not in boot parameters" % line)

# crashkernel
product_id = utils_lib.get_product_id(self)
if float(product_id) >= 9.0:
cmd = "sudo kdumpctl get-default-crashkernel"
tmp_output = utils_lib.run_cmd(
Expand Down

0 comments on commit 9686d1c

Please sign in to comment.