Skip to content

Commit

Permalink
Fixing Core tools tests (#4242)
Browse files Browse the repository at this point in the history
  • Loading branch information
aishwaryabh authored Jan 30, 2025
1 parent dad128f commit 1874ac4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/Azure.Functions.Cli.Tests/E2E/CreateFunctionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ await CliTester.Run(new RunConfiguration
"new --template TimerTrigger --name testfunc --authlevel function"
},
HasStandardError = true,
ExitInError = true,
ErrorContains = new[]
{
Constants.AuthLevelErrorMessage
Expand Down
5 changes: 5 additions & 0 deletions test/Azure.Functions.Cli.Tests/E2E/InitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down Expand Up @@ -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."
Expand All @@ -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"
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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"
Expand Down
14 changes: 13 additions & 1 deletion test/Azure.Functions.Cli.Tests/E2E/StartTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down Expand Up @@ -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, _) =>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<TestCaseFilter>(Group != RequiresNestedInProcArtifacts AND Group != UseInVisualStudioConsolidatedArtifactGeneration)</TestCaseFilter>
<TestCaseFilter>(Group != RequiresNestedInProcArtifacts) &amp; (Group != UseInVisualStudioConsolidatedArtifactGeneration) &amp; (Group != UseInConsolidatedArtifactGeneration)</TestCaseFilter>
</RunConfiguration>
</RunSettings>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public Task BundleConfiguredByDefault_no_action()
{
"No action performed"
},
ExitInError = true,
CommandTimeout = TimeSpan.FromMinutes(300)
}, _output);
}
Expand Down

0 comments on commit 1874ac4

Please sign in to comment.