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

Feat: allow cooperative timeout #3314

Merged
merged 8 commits into from
Jul 24, 2024

Conversation

Evangelink
Copy link
Member

The current implementation of the timeout will create a "thread" that will observe the execution of the step (fixture or test method) for a given time (timeout value) and will stop observing after that. This means that we are producing dangling tasks where code continues to execute and possibly mutate state when we move to the next step which can have many unwanted consequences.

With this PR, we introduce a virtuous mode that ressemble what user has to do when implementing cooperative cancellation in their production code.

/!\ It's important to note that when opting-in to this mode, if the method (fixture or test) is ignoring the token then the method will continue.

Fixes #2432

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…rties/launchSettings.json
Evangelink and others added 3 commits July 24, 2024 10:12

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…ttribute.cs

Co-authored-by: Jakub Jareš <me@jakubjares.com>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…ttribute.cs

Co-authored-by: Jakub Jareš <me@jakubjares.com>
@Evangelink Evangelink enabled auto-merge (squash) July 24, 2024 09:36
nohwnd
nohwnd previously approved these changes Jul 24, 2024
# Conflicts:
#	test/IntegrationTests/MSTest.Acceptance.IntegrationTests/InitializeAndCleanupTimeoutTests.cs
#	test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTests.cs
#	test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTests.cs
@Evangelink Evangelink disabled auto-merge July 24, 2024 13:20
@Evangelink Evangelink merged commit 8c1c353 into microsoft:main Jul 24, 2024
6 checks passed
@Evangelink Evangelink deleted the cooperative-timeout branch July 24, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timeout features should allow for a cooperative only mode
3 participants