Skip to content

Commit 2ee3825

Browse files
Fix race condition in ParameterUsingWithTests causing flaky test failures (#19317)
`ParameterUsingWithTests` had a shared `static readonly ServiceBuilder` field that parallel tests mutated concurrently via `WithMockFileSystem`, causing intermittent `System.ArgumentException: Destination array was not long enough`. ## Change Convert `Services` from a shared static field to a property so each test gets an independent `ServiceBuilder` instance: ```csharp // Before — shared, mutable across parallel tests private static readonly ServiceBuilder Services = new ServiceBuilder() .WithFeatureOverrides(new(DeployCommandsEnabled: true)); // After — fresh instance per test private static ServiceBuilder Services => new ServiceBuilder() .WithFeatureOverrides(new(DeployCommandsEnabled: true)); ``` This matches the pattern used throughout the rest of the test suite. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com>
1 parent 8b0e542 commit 2ee3825

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Bicep.Core.IntegrationTests/ParameterUsingWithTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Bicep.Core.IntegrationTests;
2020
[TestClass]
2121
public class ParameterUsingWithTests
2222
{
23-
private static readonly ServiceBuilder Services = new ServiceBuilder()
23+
private static ServiceBuilder Services => new ServiceBuilder()
2424
.WithFeatureOverrides(new(DeployCommandsEnabled: true));
2525

2626
[NotNull]

0 commit comments

Comments
 (0)