Skip to content

Commit

Permalink
Allow to ignore duration in tests
Browse files Browse the repository at this point in the history
There are other ways to adjust this value, but sometimes
it is just easier to just let test run.
  • Loading branch information
lukaszachy committed Mar 4, 2025
1 parent e05b21a commit feed288
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tmt/steps/execute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ class ExecuteStepData(tmt.steps.WhereableStepData, tmt.steps.StepData):
option='--duration',
help='The maximal time allowed for the test to run.',
)
ignore_duration: bool = field(
default=False,
option=('--ignore-duration'),
is_flag=True,
help='Ignore test duration values and allow tests run forever.',
)
exit_first: bool = field(
default=False,
option=('-x', '--exit-first'),
Expand Down Expand Up @@ -709,6 +715,7 @@ def go(
logger: tmt.log.Logger,
) -> None:
self.go_prolog(logger)
logger.verbose('ignore-duration', self.data.exit_first, 'green', level=2)
logger.verbose('exit-first', self.data.exit_first, 'green', level=2)

@property
Expand Down
4 changes: 4 additions & 0 deletions tmt/steps/execute/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,10 @@ def _save_process(

timeout = None

elif self.data.ignore_duration:
logger.debug("Test duration is not effective due ignore-duration option.")
timeout = None

else:
timeout = tmt.utils.duration_to_seconds(
test.duration, tmt.base.DEFAULT_TEST_DURATION_L1
Expand Down

0 comments on commit feed288

Please sign in to comment.