From a94c262c9bf3634a397ba3c7759207d0a8df1832 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Thu, 1 Aug 2024 23:30:37 +0200 Subject: [PATCH 1/2] Take more screenshot and add logs for BM LSO deployment Signed-off-by: Petr Balogh --- ocs_ci/ocs/ui/base_ui.py | 6 +++++- ocs_ci/ocs/ui/deployment_ui.py | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ocs_ci/ocs/ui/base_ui.py b/ocs_ci/ocs/ui/base_ui.py index 1a07a467877..44203ab8eb7 100644 --- a/ocs_ci/ocs/ui/base_ui.py +++ b/ocs_ci/ocs/ui/base_ui.py @@ -359,17 +359,21 @@ def select_checkbox_status(self, status, locator): if status != current_status: self.do_click(locator=locator) - def check_element_text(self, expected_text, element="*"): + def check_element_text(self, expected_text, element="*", take_screenshot=False): """ Check if the text matches the expected text. Args: expected_text (string): The expected text. + element (str): element (default: *) + take_screenshot (bool): if screenshot should be taken return: bool: True if the text matches the expected text, False otherwise """ + if take_screenshot: + self.take_screenshot() element_list = self.driver.find_elements_by_xpath( f"//{element}[contains(text(), '{expected_text}')]" ) diff --git a/ocs_ci/ocs/ui/deployment_ui.py b/ocs_ci/ocs/ui/deployment_ui.py index e989f4a02b0..275fdddf4a0 100644 --- a/ocs_ci/ocs/ui/deployment_ui.py +++ b/ocs_ci/ocs/ui/deployment_ui.py @@ -45,11 +45,13 @@ def verify_disks_lso_attached(self, timeout=600, sleep=20): capacity_str = str(capacity / 1024).rstrip("0").rstrip(".") + " TiB" else: capacity_str = str(capacity) + " GiB" + logger.info(f"Waiting for {capacity_str}") sample = TimeoutSampler( timeout=timeout, sleep=sleep, func=self.check_element_text, expected_text=capacity_str, + take_screenshot=True, ) if not sample.wait_for_func_status(result=True): raise TimeoutExpiredError(f"Disks are not attached after {timeout} seconds") @@ -226,6 +228,7 @@ def install_lso_cluster(self): text=constants.LOCAL_BLOCK_RESOURCE, timeout=300, ) + self.take_screenshot() self.do_send_keys( locator=self.dep_loc["sc_name"], text=constants.LOCAL_BLOCK_RESOURCE ) @@ -238,6 +241,7 @@ def install_lso_cluster(self): constants.BAREMETAL_PLATFORM, constants.HCI_BAREMETAL, ]: + self.take_screenshot() self.verify_disks_lso_attached() timeout_next = 60 else: From c091bfbe1549de612d79b944a3d8d7fa4c9334df Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Fri, 2 Aug 2024 09:56:05 +0200 Subject: [PATCH 2/2] Fix condition for verify_disks_lso_attached This PR: https://github.com/red-hat-storage/ocs-ci/pull/10120 Broke original condition: if config.ENV_DATA.get("platform") != constants.BAREMETAL_PLATFORM: and changed to: if config.ENV_DATA.get("platform") in [ constants.BAREMETAL_PLATFORM, constants.HCI_BAREMETAL, ]: There should be `not in`. Which is fixed in this commit. Signed-off-by: Petr Balogh --- ocs_ci/ocs/ui/base_ui.py | 2 +- ocs_ci/ocs/ui/deployment_ui.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ocs_ci/ocs/ui/base_ui.py b/ocs_ci/ocs/ui/base_ui.py index 44203ab8eb7..0684f12faa8 100644 --- a/ocs_ci/ocs/ui/base_ui.py +++ b/ocs_ci/ocs/ui/base_ui.py @@ -365,7 +365,7 @@ def check_element_text(self, expected_text, element="*", take_screenshot=False): Args: expected_text (string): The expected text. - element (str): element (default: *) + element (str): element take_screenshot (bool): if screenshot should be taken return: diff --git a/ocs_ci/ocs/ui/deployment_ui.py b/ocs_ci/ocs/ui/deployment_ui.py index 275fdddf4a0..d2d7fcda421 100644 --- a/ocs_ci/ocs/ui/deployment_ui.py +++ b/ocs_ci/ocs/ui/deployment_ui.py @@ -237,7 +237,7 @@ def install_lso_cluster(self): self.do_click( locator=self.dep_loc["all_nodes_create_sc"], enable_screenshot=True ) - if config.ENV_DATA.get("platform") in [ + if config.ENV_DATA.get("platform") not in [ constants.BAREMETAL_PLATFORM, constants.HCI_BAREMETAL, ]: