diff --git a/release_notes.md b/release_notes.md index aa232c219..7333dc06a 100644 --- a/release_notes.md +++ b/release_notes.md @@ -4,6 +4,8 @@ ### New Features +- Fail fast if extendedSessionsEnabled set to 'true' for the worker type that doesn't support extended sessions (https://github.com/Azure/azure-functions-durable-extension/pull/2732). + ### Bug Fixes - Fix custom connection name not working when using IDurableClientFactory.CreateClient() - contributed by [@hctan](https://github.com/hctan) diff --git a/src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs b/src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs index 937b236ea..4e59f460c 100644 --- a/src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs +++ b/src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs @@ -359,7 +359,7 @@ void IExtensionConfigProvider.Initialize(ExtensionConfigContext context) } // Throw if any of the configured options are invalid - this.Options.Validate(this.nameResolver, this.TraceHelper); + this.Options.Validate(this.nameResolver); #pragma warning disable CS0618 // Type or member is obsolete diff --git a/src/WebJobs.Extensions.DurableTask/Options/DurableTaskOptions.cs b/src/WebJobs.Extensions.DurableTask/Options/DurableTaskOptions.cs index bc555386f..c7322044e 100644 --- a/src/WebJobs.Extensions.DurableTask/Options/DurableTaskOptions.cs +++ b/src/WebJobs.Extensions.DurableTask/Options/DurableTaskOptions.cs @@ -302,7 +302,7 @@ internal void TraceConfiguration(EndToEndTraceHelper traceHelper, JObject storag traceHelper.TraceConfiguration(this.HubName, configurationJson.ToString(Formatting.None)); } - internal void Validate(INameResolver environmentVariableResolver, EndToEndTraceHelper traceHelper) + internal void Validate(INameResolver environmentVariableResolver) { if (string.IsNullOrEmpty(this.HubName)) { @@ -320,12 +320,9 @@ internal void Validate(INameResolver environmentVariableResolver, EndToEndTraceH runtimeLanguage != null && // If we don't know from the environment variable, don't assume customer isn't .NET !string.Equals(runtimeLanguage, "dotnet", StringComparison.OrdinalIgnoreCase)) { - traceHelper.ExtensionWarningEvent( - hubName: this.HubName, - functionName: string.Empty, - instanceId: string.Empty, - message: "Durable Functions does not work with extendedSessions = true for non-.NET languages. This value is being set to false instead. See https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-perf-and-scale#extended-sessions for more details."); - this.ExtendedSessionsEnabled = false; + throw new InvalidOperationException( + "Durable Functions with extendedSessionsEnabled set to 'true' is only supported when using the in-process .NET worker. Please remove the setting or change it to 'false'." + + "See https://docs.microsoft.com/azure/azure-functions/durable/durable-functions-perf-and-scale#extended-sessions for more details."); } this.Notifications.Validate(); diff --git a/test/Common/DurableTaskEndToEndTests.cs b/test/Common/DurableTaskEndToEndTests.cs index 489379cdd..0ba61d7f3 100644 --- a/test/Common/DurableTaskEndToEndTests.cs +++ b/test/Common/DurableTaskEndToEndTests.cs @@ -5592,16 +5592,24 @@ public async Task ExtendedSessions_OutOfProc_SetToFalse() { "FUNCTIONS_WORKER_RUNTIME", "node" }, }); - using (var host = TestHelpers.GetJobHostWithOptions( - this.loggerProvider, - durableTaskOptions, - nameResolver: nameResolver)) - { - await host.StartAsync(); - await host.StopAsync(); - } + InvalidOperationException exception = + await Assert.ThrowsAsync(async () => + { + using (var host = TestHelpers.GetJobHostWithOptions( + this.loggerProvider, + durableTaskOptions, + nameResolver: nameResolver)) + { + await host.StartAsync(); + await host.StopAsync(); + } + }); - Assert.False(durableTaskOptions.ExtendedSessionsEnabled); + Assert.NotNull(exception); + Assert.StartsWith( + "Durable Functions with extendedSessionsEnabled set to 'true' is only supported when using", + exception.Message, + StringComparison.OrdinalIgnoreCase); } [Fact] diff --git a/test/SmokeTests/e2e-test.ps1 b/test/SmokeTests/e2e-test.ps1 index 5eee1e0fd..ab918da8e 100644 --- a/test/SmokeTests/e2e-test.ps1 +++ b/test/SmokeTests/e2e-test.ps1 @@ -31,7 +31,7 @@ $AzuriteVersion = "3.32.0" if ($NoSetup -eq $false) { # Build the docker image first, since that's the most critical step Write-Host "Building sample app Docker container from '$DockerfilePath'..." -ForegroundColor Yellow - docker build -f $DockerfilePath -t $ImageName --progress plain $PSScriptRoot/../../ + docker build --pull -f $DockerfilePath -t $ImageName --progress plain $PSScriptRoot/../../ Exit-OnError # Next, download and start the Azurite emulator Docker image @@ -58,6 +58,16 @@ if ($NoSetup -eq $false) { Start-Sleep -Seconds 30 # Adjust the sleep duration based on your SQL Server container startup time Exit-OnError + Write-Host "Checking if SQL Server is still running..." -ForegroundColor Yellow + $sqlServerStatus = docker inspect -f '{{.State.Status}}' mssql-server + Exit-OnError + + if ($sqlServerStatus -ne "running") { + Write-Host "Unexpected SQL Server status: $sqlServerStatus" -ForegroundColor Yellow + docker logs mssql-server + exit 1; + } + # Get SQL Server IP Address - used to create SQLDB_Connection Write-Host "Getting IP Address..." -ForegroundColor Yellow $serverIpAddress = docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mssql-server