DisableParallelization for environment variables based tests#7100
Merged
amadeuszl merged 2 commits intodotnet:mainfrom Dec 2, 2025
Merged
DisableParallelization for environment variables based tests#7100amadeuszl merged 2 commits intodotnet:mainfrom
amadeuszl merged 2 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request addresses test isolation issues by disabling parallelization for tests that manipulate environment variables. The changes ensure that environment variable-based tests don't interfere with each other when running concurrently by using xUnit's collection feature with DisableParallelization = true.
Key changes include:
- Creating a test collection definition to control parallel execution of environment variable tests
- Making environment variable prefixes unique across different test scenarios (Linux, Windows, and general tests) to improve isolation
- Marking relevant test classes to be part of the non-parallelized collection
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| TestKubernetesEnvironmentSetup.cs | Added xUnit collection definition with DisableParallelization = true and updated the default environment variable prefix from "MYCLUSTER_" to "TEST_SETUP_CLUSTER_" |
| KubernetesResourceQuotasServiceCollectionExtensionsTests.cs | Incorrectly added CollectionDefinition attribute instead of Collection attribute to test class |
| KubernetesMetadataTests.cs | Correctly added Collection attribute to associate test class with the environment variable test collection |
| Windows/AcceptanceTest.cs | Changed environment variable prefix from "ACCEPTANCE_TEST_" to "ACCEPTANCE_TEST_WINDOWS_" for better test isolation |
| Linux/AcceptanceTest.cs | Changed environment variable prefix from "ACCEPTANCE_TEST_" to "ACCEPTANCE_TEST_LINUX_" for better test isolation |
...ourceMonitoring.Kubernetes.Tests/KubernetesResourceQuotasServiceCollectionExtensionsTests.cs
Outdated
Show resolved
Hide resolved
evgenyfedorov2
approved these changes
Dec 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes flaky test that failed https://dev.azure.com/dnceng-public/public/_build/results?buildId=1216646&view=ms.vss-test-web.build-test-results-tab
Microsoft Reviewers: Open in CodeFlow