Azure / Azure/azure-functions-sql-extension

Dotnet Test Fails if integration test fails at Function Host

Open
#442 0 comments 0 reactions 0 assignees View on GitHub
engineering
Dominant language
C#
Stars
130
Forks
71
Avg merge
4d 8h
Merged PRs (30d)
4

Description

Found this when testing on MacOS and Windows.

If a Integration Test fails due to a Azure Function issue then the process that hosts the Azure Function does not dispose / kill the process prior to starting the next test.

Therefore, it will fail the rest of the tests after the first failure it finds.

**Example of Dotnet error in console:**

> Failed Microsoft.Azure.WebJobs.Extensions.Sql.Tests.Integration.SqlOutputBindingIntegrationTests.AddProductParamsTest(id: 1, name: "Test", cost: 5, lang: PowerShell) [1 m]
> Error Message:
> Functions host did not start within specified time.
> Expected: True
> Actual: False
> Stack Trace:
> at Microsoft.Azure.WebJobs.Extensions.Sql.Tests.Integration.IntegrationTestBase.StartFunctionHost(String functionName, SupportedLanguages language, Boolean useTestFolder, DataReceivedEventHandler customOutputHandler, Dictionary`2 environmentVariables) in /Users/vasubhog/GitProjects/azure-functions-sql-extension/test/Integration/IntegrationTestBase.cs:line 232
> at Microsoft.Azure.WebJobs.Extensions.Sql.Tests.Integration.SqlOutputBindingIntegrationTests.AddProductParamsTest(Int32 id, String name, Int32 cost, SupportedLanguages lang) in /Users/vasubhog/GitProjects/azure-functions-sql-extension/test/Integration/SqlOutputBindingIntegrationTests.cs:line 52
> Standard Output Messages:
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/Tables/Products.sql
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/Tables/ProductsCostNotNull.sql
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/Tables/ProductsNameNotNull.sql
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/Tables/ProductsColumnTypes.sql
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/Tables/ProductsWithIdentity.sql
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/Tables/ProductsWithDefaultPK.sql
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/Tables/ProductsWithMultiplePrimaryColumnsAndIdentity.sql
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/Views/ProductsNamesView.sql
> Executing script $/Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/Database/StoredProcedures/SelectProductsCost.sql
> Starting /usr/local/bin/func start --verbose --port 7071 --functions AddProductParams in /Users/vasubhog/GitProjects/azure-functions-sql-extension/test/bin/Debug/net6/SqlExtensionSamples/PowerShell
> Waiting for Azure Function host to start...
> Port 7071 is unavailable. Close the process using that port, or specify another port using --port [-p].

Workaround:
- Comment out tests and focus on one test that is failing
- Run Ad-Hoc test to see all failures
- Kill the process manually then use [dotnet test filter](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-test#filter-option-details) to run single test case

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.