diff --git a/test/Azure.Functions.Cli.Tests/E2E/CreateFunctionTests.cs b/test/Azure.Functions.Cli.Tests/E2E/CreateFunctionTests.cs index e2f0a2a1d..d88ee482e 100644 --- a/test/Azure.Functions.Cli.Tests/E2E/CreateFunctionTests.cs +++ b/test/Azure.Functions.Cli.Tests/E2E/CreateFunctionTests.cs @@ -40,6 +40,7 @@ await CliTester.Run(new RunConfiguration "new --template TimerTrigger --name testfunc --authlevel function" }, HasStandardError = true, + ExitInError = true, ErrorContains = new[] { Constants.AuthLevelErrorMessage diff --git a/test/Azure.Functions.Cli.Tests/E2E/InitTests.cs b/test/Azure.Functions.Cli.Tests/E2E/InitTests.cs index ad1c95d90..95dda69d6 100644 --- a/test/Azure.Functions.Cli.Tests/E2E/InitTests.cs +++ b/test/Azure.Functions.Cli.Tests/E2E/InitTests.cs @@ -171,6 +171,7 @@ public Task init_with_worker_runtime_and_unsupported_model(string workerRuntime, { Commands = new[] { $"init . --worker-runtime {workerRuntime} --model {programmingModel}" }, HasStandardError = true, + ExitInError = true, ErrorContains = new[] { $"programming model is not supported for worker runtime {workerRuntime}. Supported programming models for worker runtime {workerRuntime} are:" @@ -278,6 +279,7 @@ public Task init_with_unknown_worker_runtime() { Commands = new[] { $"init . --worker-runtime {unknownWorkerRuntime}" }, HasStandardError = true, + ExitInError = true, ErrorContains = new[] { $"Worker runtime '{unknownWorkerRuntime}' is not a valid option." @@ -293,6 +295,7 @@ public Task init_with_unsupported_target_framework_for_dotnet() { Commands = new[] { $"init . --worker-runtime dotnet --target-framework {unsupportedTargetFramework}" }, HasStandardError = true, + ExitInError = true, ErrorContains = new[] { $"Unable to parse target framework {unsupportedTargetFramework} for worker runtime dotnet. Valid options are net8.0, net6.0" @@ -669,6 +672,7 @@ public Task init_docker_only_no_project() $"init . --docker-only" }, HasStandardError = true, + ExitInError = true, ErrorContains = new[] { $"Can't determine project language from files." @@ -779,6 +783,7 @@ public Task init_managed_dependencies_is_only_supported_in_powershell() $"init . --worker-runtime python --managed-dependencies " }, HasStandardError = true, + ExitInError = true, ErrorContains = new[] { $"Managed dependencies is only supported for PowerShell" diff --git a/test/Azure.Functions.Cli.Tests/E2E/StartTests.cs b/test/Azure.Functions.Cli.Tests/E2E/StartTests.cs index 123ef6614..af0872346 100644 --- a/test/Azure.Functions.Cli.Tests/E2E/StartTests.cs +++ b/test/Azure.Functions.Cli.Tests/E2E/StartTests.cs @@ -733,6 +733,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime inproc8" }, ExpectExit = true, + ExitInError = true, ErrorContains = ["Failed to locate the inproc8 model host"], Test = async (workingDir, p, _) => { @@ -766,6 +767,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose" }, ExpectExit = true, + ExitInError = true, ErrorContains = ["Failed to locate the inproc8 model host"], Test = async (workingDir, p, _) => { @@ -885,6 +887,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["Failed to locate the inproc6 model host at"], Test = async (workingDir, p, _) => { @@ -918,6 +921,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime inproc6" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["Failed to locate the inproc6 model host at"], Test = async (workingDir, p, _) => { @@ -999,7 +1003,8 @@ await CliTester.Run(new RunConfiguration[] { $"start --port {_funcHostPort} --verbose --runtime inproc6" }, - ExpectExit = false, + ExpectExit = true, + ExitInError = true, ErrorContains = ["The runtime argument value provided, 'inproc6', is invalid. The provided value is only valid for the worker runtime 'dotnet'."], Test = async (workingDir, p, _) => { @@ -1033,6 +1038,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime inproc8" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["The runtime argument value provided, 'inproc8', is invalid. The provided value is only valid for the worker runtime 'dotnet'."], Test = async (workingDir, p, _) => { @@ -1066,6 +1072,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime inproc8" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["The runtime argument value provided, 'inproc8', is invalid. For the 'inproc8' runtime, the 'FUNCTIONS_INPROC_NET8_ENABLED' environment variable must be set. See https://aka.ms/azure-functions/dotnet/net8-in-process."], Test = async (workingDir, p, _) => { @@ -1099,6 +1106,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime default" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["The runtime argument value provided, 'default', is invalid. The provided value is only valid for the worker runtime 'dotnetIsolated'."], Test = async (workingDir, p, _) => { @@ -1132,6 +1140,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime default" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["The runtime argument value provided, 'default', is invalid. The provided value is only valid for the worker runtime 'dotnetIsolated'."], Test = async (workingDir, p, _) => { @@ -1165,6 +1174,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime inproc6" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["The runtime argument value provided, 'inproc6', is invalid. For the 'inproc6' runtime, the 'FUNCTIONS_INPROC_NET8_ENABLED' environment variable cannot be be set. See https://aka.ms/azure-functions/dotnet/net8-in-process."], Test = async (workingDir, p, _) => { @@ -1199,6 +1209,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime inproc6" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["The runtime argument value provided, 'inproc6', is invalid. The provided value is only valid for the worker runtime 'dotnet'."], Test = async (workingDir, p, _) => { @@ -1233,6 +1244,7 @@ await CliTester.Run(new RunConfiguration[] $"start --port {_funcHostPort} --verbose --runtime inproc8" }, ExpectExit = false, + ExitInError = true, ErrorContains = ["The runtime argument value provided, 'inproc8', is invalid. The provided value is only valid for the worker runtime 'dotnet'."], Test = async (workingDir, p, _) => { diff --git a/test/Azure.Functions.Cli.Tests/E2E/StartTests_default.runsettings b/test/Azure.Functions.Cli.Tests/E2E/StartTests_default.runsettings index fc323d44c..36bea3ac3 100644 --- a/test/Azure.Functions.Cli.Tests/E2E/StartTests_default.runsettings +++ b/test/Azure.Functions.Cli.Tests/E2E/StartTests_default.runsettings @@ -1,6 +1,6 @@ - (Group != RequiresNestedInProcArtifacts AND Group != UseInVisualStudioConsolidatedArtifactGeneration) + (Group != RequiresNestedInProcArtifacts) & (Group != UseInVisualStudioConsolidatedArtifactGeneration) & (Group != UseInConsolidatedArtifactGeneration) \ No newline at end of file diff --git a/test/Azure.Functions.Cli.Tests/ExtensionsTests/ExtensionBundleTests.cs b/test/Azure.Functions.Cli.Tests/ExtensionsTests/ExtensionBundleTests.cs index 1fa718da6..6e8cfa473 100644 --- a/test/Azure.Functions.Cli.Tests/ExtensionsTests/ExtensionBundleTests.cs +++ b/test/Azure.Functions.Cli.Tests/ExtensionsTests/ExtensionBundleTests.cs @@ -28,6 +28,7 @@ public Task BundleConfiguredByDefault_no_action() { "No action performed" }, + ExitInError = true, CommandTimeout = TimeSpan.FromMinutes(300) }, _output); }