@@ -43,9 +43,10 @@ namespace Microsoft.Azure.WebJobs.Script.Tests
43
43
{
44
44
public class SpecializationE2ETests
45
45
{
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 ) ;
49
50
50
51
private static readonly string _standbyPath = Path . Combine ( Path . GetTempPath ( ) , "functions" , "standby" , "wwwroot" ) ;
51
52
private static readonly string _scriptRootConfigPath = ConfigurationPath . Combine ( ConfigurationSectionNames . WebHost , nameof ( ScriptApplicationHostOptions . ScriptPath ) ) ;
@@ -74,10 +75,6 @@ public SpecializationE2ETests(ITestOutputHelper testOutputHelper)
74
75
_environment = new TestEnvironment ( settings ) ;
75
76
_loggerProvider = new TestLoggerProvider ( ) ;
76
77
77
- _pauseBeforeHostBuild = new SemaphoreSlim ( 1 , 1 ) ;
78
- _pauseAfterStandbyHostBuild = new SemaphoreSlim ( 1 , 1 ) ;
79
- _buildCount = new SemaphoreSlim ( 2 , 2 ) ;
80
-
81
78
_testOutputHelper = testOutputHelper ;
82
79
}
83
80
@@ -1087,16 +1084,16 @@ private async Task DotNetIsolatedPlaceholderMiss(string scriptRootPath, Action a
1087
1084
}
1088
1085
}
1089
1086
1090
- private static void BuildDotnetIsolated60 ( )
1087
+ private static int BuildDotnetIsolated60 ( )
1091
1088
{
1092
1089
var p = Process . Start ( "dotnet" , $ "build { _dotnetIsolated60Path } /../../..") ;
1093
1090
p . WaitForExit ( ) ;
1091
+ return p . ExitCode ;
1094
1092
}
1095
1093
1096
1094
private IWebHostBuilder InitializeDotNetIsolatedPlaceholderBuilder ( string scriptRootPath , params string [ ] functions )
1097
1095
{
1098
- BuildDotnetIsolated60 ( ) ;
1099
-
1096
+ Assert . Equal ( 0 , _buildDotnetIsolated60Path . Value ) ;
1100
1097
_environment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeSettingName , "dotnet-isolated" ) ;
1101
1098
_environment . SetEnvironmentVariable ( EnvironmentSettingNames . AzureWebsiteUsePlaceholderDotNetIsolated , "1" ) ;
1102
1099
_environment . SetEnvironmentVariable ( EnvironmentSettingNames . AzureWebJobsFeatureFlags , ScriptConstants . FeatureFlagEnableWorkerIndexing ) ;
0 commit comments