Skip to content

Conversation

@TheConstructor
Copy link
Contributor

What does this PR do?

This passes TestContext.Current.CancellationToken to Container.StartAsync, so that cancelling a test-session may cancel starting the requested Testcontainer

Why is it important?

If the test-session is already set to cancelled, the fixture is likely disposed, just after being started, without being used by any test. Waiting for the start waists time and resources.

How to test this PR

Start any test utilizing Testcontainers.XunitV3, and cancel test-execution during container creation/startup. It should cancel quickly, reporting a TaskCancelledException to the test starting up

@netlify
Copy link

netlify bot commented Apr 20, 2025

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 609ad64
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/680dfe927eebc80008dc0228
😎 Deploy Preview https://deploy-preview-1431--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Apr 27, 2025
@HofmeisterAn HofmeisterAn changed the title Allow cancelling start of container as Xunit.net V3 fixture feat: Allow canceling container start in xUnit.net v3 fixtures Apr 27, 2025
Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🙇.

@HofmeisterAn HofmeisterAn merged commit 1986704 into testcontainers:develop Apr 27, 2025
69 checks passed
@TheConstructor TheConstructor deleted the feature/allow-cancel-start-of-fixture branch April 27, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants