Skip to content

Commit

Permalink
[ATL-33456] UPD: Wipe drives before each test, update recreate_pod() …
Browse files Browse the repository at this point in the history
…and _wait_cr() (#1239)
  • Loading branch information
pawel-labuz authored Nov 19, 2024
1 parent 62f2606 commit d8c2877
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
7 changes: 2 additions & 5 deletions tests/e2e-test-framework/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def pytest_addoption(parser):
parser.addoption("--namespace", action="store", default="atlantic", help="Namespace")
parser.addoption("--hosts", action="store", default=[], help="Hosts")
parser.addoption("--qtest_token", action="store", default="", help="qTest Token")
parser.addoption("--ansible_server", action="store", default="", help="Server")
parser.addoption("--qtest_test_suite", action="store", default="", help="qTest Test Suite ID")
parser.addoption("--cmo_bundle_version", action="store", default="", help="Version of CMO bundle")

Expand Down Expand Up @@ -91,10 +90,6 @@ def namespace(request) -> str:
def hosts(request):
return request.config.getoption("--hosts")

@pytest.fixture(scope="session")
def ansible_server(request):
return request.config.getoption("--ansible_server")

@pytest.fixture(scope="session")
def wire_mock():
if not Docker.is_docker_running():
Expand Down Expand Up @@ -147,6 +142,8 @@ def keep_drive_count(drive_utils_executors: Dict[str, DriveUtils]) -> Generator[

@pytest.fixture(autouse=True)
def wipe_drives(drive_utils_executors: Dict[str, DriveUtils]) -> Generator[None, None, None]:
for _, drive_utils in drive_utils_executors.items():
drive_utils.wipe_drives()
yield
for _, drive_utils in drive_utils_executors.items():
drive_utils.wipe_drives()
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-test-framework/framework/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def wipe_drives(self) -> None:
else:
raise ValueError(f"Unknown drive type: {children['type']}")

time.sleep(1)
time.sleep(2)

def _get_device_name(self, device_path_or_name: str) -> str:
return (
Expand Down
9 changes: 4 additions & 5 deletions tests/e2e-test-framework/framework/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def _wait_cr(
retry_count = 0
cr = None
while time.time() < end_time:
if retry_count > 0:
if retry_count % 40 == 0:
logging.warning(
f"CR is not in expected state, retry number: {retry_count}"
)
Expand All @@ -543,7 +543,7 @@ def _wait_cr(
if all(assertions.values()):
return True

time.sleep(1)
time.sleep(0.05)
retry_count += 1

for k, v in assertions.items():
Expand Down Expand Up @@ -687,15 +687,14 @@ def recreate_pod(self, name: str, namespace: str) -> V1Pod:
"""
self.core_v1_api.delete_namespaced_pod(name=name, namespace=namespace)
logging.info(f"pod {name} deleted, waiting for a new pod to be created")

time.sleep(5)
pod = self.list_pods(name, namespace=namespace)[0]

assert self.is_pod_ready(
name, timeout=150
), "pod not ready after 150 seconds timeout"
logging.info(f"pod {name} is ready")

return pod
return self.list_pods(name, namespace=namespace)[0]

def wait_for_event_with_reason(
self, reason: str, timeout_seconds: int = 90
Expand Down

0 comments on commit d8c2877

Please sign in to comment.