Skip to content

Commit a179d7c

Browse files
nohwnd-botCopilot
andauthored
[ResourceLock] Narrow AzureFoundryChatClientProviderTests scope to EnvironmentVariables (#11053)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 839bc07 commit a179d7c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎test/UnitTests/Microsoft.Testing.Extensions.UnitTests/AzureFoundryChatClientProviderTests.cs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ namespace Microsoft.Testing.Extensions.UnitTests;
1212

1313
// The provider reads process-wide AZURE_OPENAI_* environment variables, so these tests must not run
1414
// concurrently with each other. Each test snapshots and restores the variables to avoid leaking state.
15+
// A class-level [ResourceLock(WellKnownResources.EnvironmentVariables)] (instead of [DoNotParallelize])
16+
// still serializes this class against itself and against every other test in the assembly that mutates
17+
// environment variables, which is required because the resource is process-wide; but it allows this
18+
// class to run in parallel with tests that never touch environment variables at all.
1519
[TestClass]
16-
[DoNotParallelize]
20+
[ResourceLock(WellKnownResources.EnvironmentVariables)]
1721
public sealed class AzureFoundryChatClientProviderTests
1822
{
1923
private const string EndpointVariable = "AZURE_OPENAI_ENDPOINT";

0 commit comments

Comments
 (0)