Skip to content

Commit

Permalink
added is_ostree_system to identify bootc system
Browse files Browse the repository at this point in the history
- use utils_lib.save_file() in dmidecode_debug.bin and sos report
  collection
- added new added command line params to os-tests.yaml file with
  instructions

Signed-off-by: Xiao Liang <[email protected]>
  • Loading branch information
liangxiao1 committed Oct 14, 2024
1 parent f41a927 commit bae9bc5
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 31 deletions.
2 changes: 1 addition & 1 deletion os_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.3.0'
__codedate__ = '20240920'
__codedate__ = '20241009'
21 changes: 20 additions & 1 deletion os_tests/cfg/os-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,23 @@ dnf_repo_url:
# specify it when leapp upgrade via custom repo, can pass more seperated by ","
leapp_target_repo_url:
# add more information about test run
comment: ""
comment: ""
###################################
# below options are params for building bootc system images
###################################
# specify the disk image format to build disk image for image mode testing, e.g., 9.4
disk_image_format:
# specify the path of container file
containerfile:
# specify the base rhel bootc container image repo
bootc_base_image_url:
# specify the login data for quay.io, e.g., username,password,quay.io
quay_io_data:
# specify the login data for bootc repo, e.g., e.g., username,password,bootc io name
bootc_io_data:
# specify the previous bootc_base_image_digest
bootc_base_image_digest:
# specify the config_toml for login info of the custom container disk image
config_toml_file:
# specify login info of the custom container disk image
config_toml_info:
12 changes: 12 additions & 0 deletions os_tests/data/baseline_log.json
Original file line number Diff line number Diff line change
Expand Up @@ -2337,5 +2337,17 @@
"cases": "",
"addedby": "[email protected]",
"addeddate": "20240926"
},
"msg_250": {
"content": ".*Version: (invalid).*",
"analyze": "dmidecode known issue",
"branch": "rhel",
"status": "active",
"link": "https://issues.redhat.com/browse/RHEL-61831",
"path": "",
"trigger": "",
"cases": "os_tests.tests.test_general_check.TestGeneralCheck.test_check_dmidecode_outofspec",
"addedby": "[email protected]",
"addeddate": "20241009"
}
}
18 changes: 16 additions & 2 deletions os_tests/libs/utils_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2111,10 +2111,24 @@ def configure_repo(test_instance, repo_type=None, repo_url_param=None, rmt_node=
def save_file(test_instance, file_dir=None, file_name=None, rmt_node=None, vm=None):
saved_file = '{}/{}'.format(file_dir, file_name)
if test_instance.params['remote_nodes'] is not None:
cmd = "sudo cp {} /tmp/".format(saved_file)
cmd = "sudo cp -f {} /tmp/".format(saved_file)
run_cmd(test_instance, cmd, msg='Prepare for saving {}'.format(saved_file))
test_instance.SSH.get_file(rmt_file='/tmp/{}'.format(file_name),
local_file='{}/attachments/{}'.format(test_instance.log_dir, file_name))
else:
cmd = "sudo cp {} {}/attachments/".format(saved_file, test_instance.log_dir)
cmd = "sudo cp -f {} {}/attachments/".format(saved_file, test_instance.log_dir)
run_cmd(test_instance, cmd, msg='Save {}'.format(saved_file))

def is_ostree_system(test_instance):
'''
/run/ostree-booted exists or not
'''
cmd = "ls -l /run/ostree-booted"
ret = run_cmd(test_instance, cmd, msg='check if /run/ostree-booted exists', ret_status=True)
if ret == 0:
test_instance.log.info("The system is ostree booted.")
return True
else:
test_instance.log.info("The system is not ostree booted.")
return False

47 changes: 20 additions & 27 deletions os_tests/tests/test_general_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,12 @@ def test_check_dmidecode_dump_segfault(self):
2
component:
dmidecode
bugzilla_id:
1885823
customer_case_id:
02939365
bug_id:
bugzilla_1885823
is_customer_case:
True
attached_customer_cases:
3
polarion_id:
n/a
maintainer:
Expand All @@ -415,14 +417,10 @@ def test_check_dmidecode_dump_segfault(self):
No segmentation fault found.
'''
utils_lib.is_cmd_exist(self, cmd='dmidecode')
if self.params.get('remote_node') is not None:
binfile = '/tmp/dmidecode_debug.bin'
cmd = "sudo dmidecode --dump-bin {}".format(binfile)
utils_lib.run_cmd(self, cmd, msg='save dmidecode_debug.bin for debug purpose, please attach it if file bug')
self.SSH.get_file(rmt_file=binfile,local_file='{}/attachments/dmidecode_debug.bin'.format(self.log_dir))
else:
cmd = "sudo dmidecode --dump-bin {}/attachments/dmidecode_debug.bin".format(self.log_dir)
utils_lib.run_cmd(self, cmd, msg='save dmidecode_debug.bin for debug purpose, please attach it if file bug')

cmd = "sudo dmidecode --dump-bin /tmp/dmidecode_debug.bin"
utils_lib.run_cmd(self, cmd, msg='save dmidecode_debug.bin for debug purpose, please attach it if file bug')
utils_lib.save_file(self, file_dir='/tmp', file_name='dmidecode_debug.bin')
cmd = "sudo dmidecode --dump"
utils_lib.run_cmd(self, cmd, expect_ret=0, expect_not_kw='Segmentation')

Expand All @@ -432,8 +430,8 @@ def test_check_dmidecode_outofspec(self):
test_check_dmidecode_outofspec
component:
dmidecode
bugzilla_id:
1858350
bug_id:
bugzilla_1858350, jira_RHEL-61831
maintainer:
[email protected]
is_customer_case:
Expand All @@ -449,8 +447,9 @@ def test_check_dmidecode_outofspec(self):
dmidecode_debug.bin
"""
utils_lib.is_cmd_exist(self, cmd='dmidecode')
cmd = "sudo dmidecode --dump-bin {}/attachments/dmidecode_debug.bin".format(self.log_dir)
cmd = "sudo dmidecode --dump-bin /tmp/dmidecode_debug.bin"
utils_lib.run_cmd(self, cmd, msg='save dmidecode_debug.bin for debug purpose, please attach it if file bug')
utils_lib.save_file(self, file_dir='/tmp', file_name='dmidecode_debug.bin')
utils_lib.check_log(self,'OUT OF SPEC', log_cmd='sudo dmidecode', expect_ret=0, msg='Check there is no "OUT OF SPEC" in dmidecode output')

def test_check_cpu_vulnerabilities(self):
Expand Down Expand Up @@ -884,11 +883,13 @@ def test_check_journalctl_invalid(self):
case_name:
test_check_journalctl_invalid
component:
sg3_utils
bugzilla_id:
1750417
journal
bug_id:
bugzilla_1750417
is_customer_case:
True
attached_customer_cases:
4
maintainer:
[email protected]
description:
Expand All @@ -900,10 +901,6 @@ def test_check_journalctl_invalid(self):
debug_want:
journal log
"""
'''
polarion_id:
bz:1750417
'''
utils_lib.check_log(self, 'invalid', skip_words="Invalid user,invalid user", rmt_redirect_stdout=True)

def test_check_journalctl_service_unknown_lvalue(self):
Expand Down Expand Up @@ -2072,11 +2069,7 @@ def test_check_sos_works(self):
sosfile = sosfile.strip('\n')
cmd = 'sudo chmod 766 {}'.format(sosfile)
utils_lib.run_cmd(self, cmd, expect_ret=0)
if self.params.get('remote_node') is not None:
self.SSH.get_file(rmt_file=sosfile,local_file='{}/attachments/{}'.format(self.log_dir,os.path.basename(sosfile)))
else:
cmd = "cp {} {}/attachments/{}".format(sosfile, self.log_dir,os.path.basename(sosfile) )
utils_lib.run_cmd(self, cmd, msg='save {} to {}'.format(sosfile, self.log_dir))
utils_lib.save_file(self, file_dir=os.path.dirname(sosfile), file_name=os.path.basename(sosfile))

def test_check_dmesg_sev(self):
"""
Expand Down
2 changes: 2 additions & 0 deletions os_tests/tests/test_general_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,8 @@ def test_grub2_mkconfig(self):
"""
if utils_lib.is_arch(self, arch='s390x'):
self.skipTest("Skip grub check on s390x")
if utils_lib.is_ostree_system(self):
self.skipTest("Skip on ostree system, see RHEL-59866")
utils_lib.run_cmd(self,'sudo cat /etc/default/grub',msg="show default grub setting")
cmd = 'rpm -qa "grub2*"'
utils_lib.run_cmd(self,cmd,msg="show grub version")
Expand Down

0 comments on commit bae9bc5

Please sign in to comment.