Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[in-proc backport] Fix intermittent test failures due to SDK issues (#10063) #10071

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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