From bae9bc5236176d0bfdbdab46b34355f2ca6d4b7b Mon Sep 17 00:00:00 2001 From: Xiao Liang Date: Mon, 14 Oct 2024 17:11:59 +0800 Subject: [PATCH] added is_ostree_system to identify bootc system - 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 --- os_tests/__init__.py | 2 +- os_tests/cfg/os-tests.yaml | 21 ++++++++++++- os_tests/data/baseline_log.json | 12 +++++++ os_tests/libs/utils_lib.py | 18 +++++++++-- os_tests/tests/test_general_check.py | 47 ++++++++++++---------------- os_tests/tests/test_general_test.py | 2 ++ 6 files changed, 71 insertions(+), 31 deletions(-) diff --git a/os_tests/__init__.py b/os_tests/__init__.py index 467aad37..942d36d5 100644 --- a/os_tests/__init__.py +++ b/os_tests/__init__.py @@ -1,2 +1,2 @@ __version__ = '0.3.0' -__codedate__ = '20240920' \ No newline at end of file +__codedate__ = '20241009' \ No newline at end of file diff --git a/os_tests/cfg/os-tests.yaml b/os_tests/cfg/os-tests.yaml index 1353e676..14df83d3 100644 --- a/os_tests/cfg/os-tests.yaml +++ b/os_tests/cfg/os-tests.yaml @@ -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: "" \ No newline at end of file +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: \ No newline at end of file diff --git a/os_tests/data/baseline_log.json b/os_tests/data/baseline_log.json index 5bb19759..690cbc60 100644 --- a/os_tests/data/baseline_log.json +++ b/os_tests/data/baseline_log.json @@ -2337,5 +2337,17 @@ "cases": "", "addedby": "xiliang@redhat.com", "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": "xiliang@redhat.com", + "addeddate": "20241009" } } \ No newline at end of file diff --git a/os_tests/libs/utils_lib.py b/os_tests/libs/utils_lib.py index e5293354..08f6111c 100644 --- a/os_tests/libs/utils_lib.py +++ b/os_tests/libs/utils_lib.py @@ -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 + diff --git a/os_tests/tests/test_general_check.py b/os_tests/tests/test_general_check.py index 34334a8c..5a166f61 100644 --- a/os_tests/tests/test_general_check.py +++ b/os_tests/tests/test_general_check.py @@ -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: @@ -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') @@ -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: xiliang@redhat.com is_customer_case: @@ -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): @@ -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: xiliang@redhat.com description: @@ -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): @@ -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): """ diff --git a/os_tests/tests/test_general_test.py b/os_tests/tests/test_general_test.py index efd563c2..39535353 100644 --- a/os_tests/tests/test_general_test.py +++ b/os_tests/tests/test_general_test.py @@ -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")