Skip to content

Commit c247ea1

Browse files
4.25.3 hotfix (#3465)
* Increased timeouts for Node tests (#3463) * Updated the template versions. * Increased the timeouts in the node tests. * Enabling Worker Indexing (#3458) * Updated the template versions. * Enable worker indexing * Add ability to users to override worker index flag. --------- Co-authored-by: Khuram Khan <[email protected]>
1 parent fedd855 commit c247ea1

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/Azure.Functions.Cli/Actions/HostActions/StartHostAction.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ private async Task<IWebHost> BuildWebHost(ScriptApplicationHostOptions hostOptio
190190
settings.AddRange(LanguageWorkerHelper.GetWorkerConfiguration(LanguageWorkerSetting));
191191
_keyVaultReferencesManager.ResolveKeyVaultReferences(settings);
192192
UpdateEnvironmentVariables(settings);
193+
EnableWorkerIndexing(settings);
193194

194195
var defaultBuilder = Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(Array.Empty<string>());
195196

@@ -306,6 +307,15 @@ private void EnableDotNetWorkerStartup()
306307
{
307308
Environment.SetEnvironmentVariable("DOTNET_STARTUP_HOOKS", "Microsoft.Azure.Functions.Worker.Core");
308309
}
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+
}
309319

310320
private void UpdateEnvironmentVariables(IDictionary<string, string> secrets)
311321
{

src/Azure.Functions.Cli/Common/Constants.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ internal static class Constants
8383
public const string FunctionAppDeploymentToContainerAppsFailedMessage = "Deploy function app request to Container Apps was not successful.";
8484
public const string FunctionAppFailedToDeployOnContainerAppsMessage = "Failed to deploy function app to Container Apps.";
8585
public const string LocalSettingsJsonFileName = "local.settings.json";
86+
public const string EnableWorkerIndexEnvironmentVariableName = "FunctionsHostingConfig__WORKER_INDEXING_ENABLED";
87+
88+
8689

8790
public static string CliVersion => typeof(Constants).GetTypeInfo().Assembly.GetName().Version.ToString(3);
8891

test/Azure.Functions.Cli.Tests/E2E/StartTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ await CliTester.Run(new RunConfiguration
143143
await Task.Delay(TimeSpan.FromSeconds(15));
144144
p.Kill();
145145
},
146+
CommandTimeout = TimeSpan.FromSeconds(120),
146147
}, _output);
147148
}
148149

@@ -438,7 +439,8 @@ await CliTester.Run(new RunConfiguration
438439
},
439440
ExpectExit = true,
440441
ExitInError = true,
441-
ErrorContains = new[] { "Port 8081 is unavailable" }
442+
ErrorContains = new[] { "Port 8081 is unavailable" },
443+
CommandTimeout = TimeSpan.FromSeconds(120),
442444
}, _output);
443445
}
444446
finally

0 commit comments

Comments
 (0)