Skip to content

Commit e474e0b

Browse files
authored
Fix intermittent test failures due to SDK issues (#10063)
* Fix intermittent test failures due to SDK issues * Update dotnet e2e tst * Revert SDK, ensure build only once * Remove unused using
1 parent 7ea046b commit e474e0b

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/SpecializationE2ETests.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ namespace Microsoft.Azure.WebJobs.Script.Tests
4343
{
4444
public class SpecializationE2ETests
4545
{
46-
private static SemaphoreSlim _pauseBeforeHostBuild;
47-
private static SemaphoreSlim _pauseAfterStandbyHostBuild;
48-
private static SemaphoreSlim _buildCount;
46+
private static readonly Lazy<int> _buildDotnetIsolated60Path = new(BuildDotnetIsolated60, LazyThreadSafetyMode.ExecutionAndPublication);
47+
private static readonly SemaphoreSlim _pauseBeforeHostBuild = new(1, 1);
48+
private static readonly SemaphoreSlim _pauseAfterStandbyHostBuild = new(1, 1);
49+
private static readonly SemaphoreSlim _buildCount = new(2, 2);
4950

5051
private static readonly string _standbyPath = Path.Combine(Path.GetTempPath(), "functions", "standby", "wwwroot");
5152
private static readonly string _scriptRootConfigPath = ConfigurationPath.Combine(ConfigurationSectionNames.WebHost, nameof(ScriptApplicationHostOptions.ScriptPath));
@@ -74,10 +75,6 @@ public SpecializationE2ETests(ITestOutputHelper testOutputHelper)
7475
_environment = new TestEnvironment(settings);
7576
_loggerProvider = new TestLoggerProvider();
7677

77-
_pauseBeforeHostBuild = new SemaphoreSlim(1, 1);
78-
_pauseAfterStandbyHostBuild = new SemaphoreSlim(1, 1);
79-
_buildCount = new SemaphoreSlim(2, 2);
80-
8178
_testOutputHelper = testOutputHelper;
8279
}
8380

@@ -1087,16 +1084,16 @@ private async Task DotNetIsolatedPlaceholderMiss(string scriptRootPath, Action a
10871084
}
10881085
}
10891086

1090-
private static void BuildDotnetIsolated60()
1087+
private static int BuildDotnetIsolated60()
10911088
{
10921089
var p = Process.Start("dotnet", $"build {_dotnetIsolated60Path}/../../..");
10931090
p.WaitForExit();
1091+
return p.ExitCode;
10941092
}
10951093

10961094
private IWebHostBuilder InitializeDotNetIsolatedPlaceholderBuilder(string scriptRootPath, params string[] functions)
10971095
{
1098-
BuildDotnetIsolated60();
1099-
1096+
Assert.Equal(0, _buildDotnetIsolated60Path.Value);
11001097
_environment.SetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeSettingName, "dotnet-isolated");
11011098
_environment.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebsiteUsePlaceholderDotNetIsolated, "1");
11021099
_environment.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebJobsFeatureFlags, ScriptConstants.FeatureFlagEnableWorkerIndexing);

0 commit comments

Comments
 (0)