File tree 3 files changed +16
-1
lines changed
test/Azure.Functions.Cli.Tests/E2E 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,7 @@ private async Task<IWebHost> BuildWebHost(ScriptApplicationHostOptions hostOptio
190
190
settings . AddRange ( LanguageWorkerHelper . GetWorkerConfiguration ( LanguageWorkerSetting ) ) ;
191
191
_keyVaultReferencesManager . ResolveKeyVaultReferences ( settings ) ;
192
192
UpdateEnvironmentVariables ( settings ) ;
193
+ EnableWorkerIndexing ( settings ) ;
193
194
194
195
var defaultBuilder = Microsoft . AspNetCore . WebHost . CreateDefaultBuilder ( Array . Empty < string > ( ) ) ;
195
196
@@ -306,6 +307,15 @@ private void EnableDotNetWorkerStartup()
306
307
{
307
308
Environment . SetEnvironmentVariable ( "DOTNET_STARTUP_HOOKS" , "Microsoft.Azure.Functions.Worker.Core" ) ;
308
309
}
310
+
311
+ private void EnableWorkerIndexing ( IDictionary < string , string > secrets )
312
+ {
313
+ // Set only if the environment variable already doesn't exist and app setting doesn't have this setting.
314
+ if ( Environment . GetEnvironmentVariable ( Constants . EnableWorkerIndexEnvironmentVariableName ) == null && ! secrets . ContainsKey ( Constants . EnableWorkerIndexEnvironmentVariableName ) )
315
+ {
316
+ Environment . SetEnvironmentVariable ( Constants . EnableWorkerIndexEnvironmentVariableName , 1 . ToString ( ) ) ;
317
+ }
318
+ }
309
319
310
320
private void UpdateEnvironmentVariables ( IDictionary < string , string > secrets )
311
321
{
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ internal static class Constants
83
83
public const string FunctionAppDeploymentToContainerAppsFailedMessage = "Deploy function app request to Container Apps was not successful." ;
84
84
public const string FunctionAppFailedToDeployOnContainerAppsMessage = "Failed to deploy function app to Container Apps." ;
85
85
public const string LocalSettingsJsonFileName = "local.settings.json" ;
86
+ public const string EnableWorkerIndexEnvironmentVariableName = "FunctionsHostingConfig__WORKER_INDEXING_ENABLED" ;
87
+
88
+
86
89
87
90
public static string CliVersion => typeof ( Constants ) . GetTypeInfo ( ) . Assembly . GetName ( ) . Version . ToString ( 3 ) ;
88
91
Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ await CliTester.Run(new RunConfiguration
143
143
await Task . Delay ( TimeSpan . FromSeconds ( 15 ) ) ;
144
144
p . Kill ( ) ;
145
145
} ,
146
+ CommandTimeout = TimeSpan . FromSeconds ( 120 ) ,
146
147
} , _output ) ;
147
148
}
148
149
@@ -438,7 +439,8 @@ await CliTester.Run(new RunConfiguration
438
439
} ,
439
440
ExpectExit = true ,
440
441
ExitInError = true ,
441
- ErrorContains = new [ ] { "Port 8081 is unavailable" }
442
+ ErrorContains = new [ ] { "Port 8081 is unavailable" } ,
443
+ CommandTimeout = TimeSpan . FromSeconds ( 120 ) ,
442
444
} , _output ) ;
443
445
}
444
446
finally
You can’t perform that action at this time.
0 commit comments