|
29 | 29 | set_must_gather_collector_directory, |
30 | 30 | set_must_gather_collector_values, |
31 | 31 | get_must_gather_collector_dir, |
32 | | - collect_rhoai_must_gather, |
| 32 | + collect_rhoai_must_gather, get_base_dir, |
33 | 33 | ) |
34 | 34 |
|
35 | 35 | LOGGER = logging.getLogger(name=__name__) |
@@ -223,7 +223,8 @@ def _add_upgrade_test(_item: Item, _upgrade_deployment_modes: list[str]) -> bool |
223 | 223 |
|
224 | 224 |
|
225 | 225 | def pytest_sessionstart(session: Session) -> None: |
226 | | - tests_log_file = session.config.getoption("log_file") or "pytest-tests.log" |
| 226 | + log_file = session.config.getoption("log_file") or "pytest-tests.log" |
| 227 | + tests_log_file = os.path.join(get_base_dir(), log_file) |
227 | 228 | if os.path.exists(tests_log_file): |
228 | 229 | pathlib.Path(tests_log_file).unlink() |
229 | 230 |
|
@@ -252,7 +253,6 @@ def pytest_runtest_setup(item: Item) -> None: |
252 | 253 | BASIC_LOGGER.info(f"\n{separator(symbol_='-', val=item.name)}") |
253 | 254 | BASIC_LOGGER.info(f"{separator(symbol_='-', val='SETUP')}") |
254 | 255 | if item.config.getoption("--collect-must-gather"): |
255 | | - BASIC_LOGGER.info("I am here") |
256 | 256 | # set must-gather collection directory: |
257 | 257 | set_must_gather_collector_directory(item=item, directory_path=get_must_gather_collector_dir()) |
258 | 258 |
|
@@ -342,7 +342,8 @@ def pytest_sessionfinish(session: Session, exitstatus: int) -> None: |
342 | 342 | def calculate_must_gather_timer(test_start_time: int) -> int: |
343 | 343 | default_duration = 300 |
344 | 344 | if test_start_time > 0: |
345 | | - return int(datetime.datetime.now().strftime("%s")) - test_start_time |
| 345 | + duration = int(datetime.datetime.now().strftime("%s")) - test_start_time |
| 346 | + return duration if duration > 60 else default_duration |
346 | 347 | else: |
347 | 348 | LOGGER.warning(f"Could not get start time of test. Collecting must-gather for last {default_duration}s") |
348 | 349 | return default_duration |
|
0 commit comments