Skip to content

Commit

Permalink
Fix intermittent test failures due to SDK issues (#10063) (#10071)
Browse files Browse the repository at this point in the history
  • Loading branch information
jviau committed May 6, 2024
1 parent e0c0160 commit 2b4c913
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ namespace Microsoft.Azure.WebJobs.Script.Tests
{
public class SpecializationE2ETests
{
private static SemaphoreSlim _pauseBeforeHostBuild;
private static SemaphoreSlim _pauseAfterStandbyHostBuild;
private static SemaphoreSlim _buildCount;
private static readonly Lazy<int> _buildDotnetIsolated60Path = new(BuildDotnetIsolated60, LazyThreadSafetyMode.ExecutionAndPublication);
private static readonly SemaphoreSlim _pauseBeforeHostBuild = new(1, 1);
private static readonly SemaphoreSlim _pauseAfterStandbyHostBuild = new(1, 1);
private static readonly SemaphoreSlim _buildCount = new(2, 2);

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

_pauseBeforeHostBuild = new SemaphoreSlim(1, 1);
_pauseAfterStandbyHostBuild = new SemaphoreSlim(1, 1);
_buildCount = new SemaphoreSlim(2, 2);

_testOutputHelper = testOutputHelper;
}

Expand Down Expand Up @@ -1087,16 +1084,16 @@ private async Task DotNetIsolatedPlaceholderMiss(string scriptRootPath, Action a
}
}

private static void BuildDotnetIsolated60()
private static int BuildDotnetIsolated60()
{
var p = Process.Start("dotnet", $"build {_dotnetIsolated60Path}/../../..");
p.WaitForExit();
return p.ExitCode;
}

private IWebHostBuilder InitializeDotNetIsolatedPlaceholderBuilder(string scriptRootPath, params string[] functions)
{
BuildDotnetIsolated60();

Assert.Equal(0, _buildDotnetIsolated60Path.Value);
_environment.SetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeSettingName, "dotnet-isolated");
_environment.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebsiteUsePlaceholderDotNetIsolated, "1");
_environment.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebJobsFeatureFlags, ScriptConstants.FeatureFlagEnableWorkerIndexing);
Expand Down

0 comments on commit 2b4c913

Please sign in to comment.