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

Updating FunctionsNetHost (dotnet isolated worker) to 1.0.9 #10262

Merged
merged 11 commits into from
Jul 15, 2024
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
- Ordered invocations are now the default (#10201)
- Skip worker description if none of the profile conditions are met (#9932)
- Fixed incorrect function count in the log message.(#10220)
- Updated dotnet-isolated worker to [1.0.9](https://github.com/Azure/azure-functions-dotnet-worker/pull/2552)
kshyju marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion src/WebJobs.Script/WebJobs.Script.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer" Version="2.22.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.2.0" NoWarn="NU1701" />
<PackageReference Include="Microsoft.Azure.Functions.DotNetIsolatedNativeHost" Version="1.0.8" />
<PackageReference Include="Microsoft.Azure.Functions.DotNetIsolatedNativeHost" Version="1.0.9" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.41-11331" />
<PackageReference Include="Microsoft.Azure.WebJobs.Host.Storage" Version="5.0.0-beta.2-11957" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights
public abstract class ApplicationInsightsEndToEndTestsBase<TTestFixture>
: IClassFixture<TTestFixture> where TTestFixture : ApplicationInsightsTestFixture, new()
{
private const string LanguageWorkerConfigLogCategory = "Host.LanguageWorkerConfig";
kshyju marked this conversation as resolved.
Show resolved Hide resolved
private ApplicationInsightsTestFixture _fixture;

public ApplicationInsightsEndToEndTestsBase(ApplicationInsightsTestFixture fixture)
Expand Down Expand Up @@ -274,7 +275,7 @@ public async Task Validate_HostLogs()
!t.Message.Contains("Skipping WorkerConfig for language")
).ToArray();

int expectedCount = 16;
int expectedCount = 18;
Assert.True(traces.Length == expectedCount, $"Expected {expectedCount} messages, but found {traces.Length}. Actual logs:{Environment.NewLine}{string.Join(Environment.NewLine, traces.Select(t => t.Message))}");

int idx = 0;
Expand All @@ -294,6 +295,11 @@ public async Task Validate_HostLogs()
ValidateTrace(traces[idx++], "Job host started", LogCategories.Startup);
ValidateTrace(traces[idx++], "Loading functions metadata", LogCategories.Startup);
ValidateTrace(traces[idx++], "Reading functions metadata", LogCategories.Startup);

// The dotnet-isolated worker will not be loaded for this test as it is setup to run only in placeholder mode.
ValidateTrace(traces[idx++], "Skipping WorkerConfig for stack: dotnet-isolated since it is disabled.", LanguageWorkerConfigLogCategory);
// TO DO: Investigate why the message is logged twice. Tracking issue: https://github.com/Azure/azure-functions-host/issues/10268
ValidateTrace(traces[idx++], "Skipping WorkerConfig for stack: dotnet-isolated since it is disabled.", LanguageWorkerConfigLogCategory);
kshyju marked this conversation as resolved.
Show resolved Hide resolved
ValidateTrace(traces[idx++], "Starting Host (HostId=", LogCategories.Startup);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ public void LanguageWorkerOptions_Expected_ListOfConfigs(string workerRuntime)
{
testEnvironment.SetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeSettingName, workerRuntime);
}
else
{
// dotnet-isolated worker config requires placehoolder mode env variable to be set to 1.
kshyju marked this conversation as resolved.
Show resolved Hide resolved
testEnvironment.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebsitePlaceholderMode, "1");
kshyju marked this conversation as resolved.
Show resolved Hide resolved
}

testProfileManager.Setup(pm => pm.LoadWorkerDescriptionFromProfiles(It.IsAny<RpcWorkerDescription>(), out It.Ref<RpcWorkerDescription>.IsAny))
.Callback((RpcWorkerDescription defaultDescription, out RpcWorkerDescription outDescription) =>
{
// dotnet-isolated worker config does not have "DefaultExecutablePath" in the parent level.So we should set it from a profile.
kshyju marked this conversation as resolved.
Show resolved Hide resolved
if (defaultDescription.Language == "dotnet-isolated")
{
outDescription = new RpcWorkerDescription() { DefaultExecutablePath = "testPath", Language = "dotnet-isolated" };
}
else
{
// for other workers, we should return the default description as they have the "DefaultExecutablePath" in the parent level.
outDescription = defaultDescription;
}
});

LanguageWorkerOptionsSetup setup = new LanguageWorkerOptionsSetup(configuration, NullLoggerFactory.Instance, testEnvironment, testMetricLogger, testProfileManager.Object);
LanguageWorkerOptions options = new LanguageWorkerOptions();
Expand Down
1 change: 0 additions & 1 deletion test/WebJobs.Script.Tests/ScriptHostTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,6 @@ public async Task Initialize_LogsWarningForExplicitlySetHostId()

[Theory]
[InlineData("python", "main.py", "python", "python")]
[InlineData("dotnet-isolated", "app.dll", "dotnet-isolated", "dotnet-isolated")]
kshyju marked this conversation as resolved.
Show resolved Hide resolved
[InlineData("dotnet", "app.dll", "dotnet", DotNetScriptTypes.DotNetAssembly)]
[InlineData(null, "app.dll", "dotnet", DotNetScriptTypes.DotNetAssembly)] // if FUNCTIONS_WORKER_RUNTIME is missing, assume dotnet
public async Task Initialize_MissingWorkerRuntime_SetsCorrectRuntimeFromFunctionMetadata(string functionsWorkerRuntime, string scriptFile, string expectedMetricLanguage, string expectedMetadataLanguage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public void DefaultWorkerConfigs_Overrides_DefaultWorkerRuntimeVersion_AppSettin
var config = configBuilder.Build();
var scriptSettingsManager = new ScriptSettingsManager(config);
var testLogger = new TestLogger("test");
_testEnvironment.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebsitePlaceholderMode, "1");
kshyju marked this conversation as resolved.
Show resolved Hide resolved
using (var variables = new TestScopedSettings(scriptSettingsManager, testEnvVariables))
{
var configFactory = new RpcWorkerConfigFactory(config, testLogger, _testSysRuntimeInfo, _testEnvironment, new TestMetricsLogger(), _testWorkerProfileManager);
Expand Down
Loading