Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block timeout introduction #6031

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

richtja
Copy link
Contributor

@richtja richtja commented Sep 17, 2024

This commit introduces a new timeout feature, which adds the possibility to set a specific timeout for a block of code with context manager like this:

with self.wait_max(3):
	#code which should take max 3 seconds
	...

The wait_max method will send SIGALRM if the code doesn't end within 3 seconds. This signal will be caught by avocado-instrumented runner, which will interrupt the test, the same way as with a regular timeout.

Reference: #5994

@richtja richtja self-assigned this Sep 17, 2024
@richtja richtja added this to the 108 - Codename TBD milestone Sep 17, 2024
@richtja richtja marked this pull request as draft September 17, 2024 16:01
@richtja richtja force-pushed the multiple_timeouts branch 2 times, most recently from 006ca81 to 9e185ae Compare September 18, 2024 09:03
@richtja richtja marked this pull request as ready for review September 18, 2024 09:20
@richtja richtja linked an issue Sep 18, 2024 that may be closed by this pull request
@richtja
Copy link
Contributor Author

richtja commented Sep 24, 2024

Hi @mhartmay, this is something you might be interested in, and I would like to see your opinion. Please have a look.

This commit introduces a new timeout feature, which adds the possibility
to set a specific timeout for a block of code with context manager like
this:

	with self.wait_max(3):
		#code which should take max 3 seconds
		...

The  `wait_max` method will send `SIGTERM` if the code doesn't end
within 3 seconds. This signal will be caught by avocado-instrumented
runner, which will interrupt the test, the same way as with a regular
timeout.

Reference: avocado-framework#5994
Signed-off-by: Jan Richter <jarichte@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review Requested
Development

Successfully merging this pull request may close these issues.

Multiple timeouts within a test
2 participants