Skip to content

Dotnet Test Fails if integration test fails at Function Host #442

@VasuBhog

Description

@VasuBhog

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 to run single test case

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions