Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotnet unit tests are not showing which test is failing #2304

Closed
varndellwagglebee opened this issue May 25, 2023 · 2 comments
Closed

Dotnet unit tests are not showing which test is failing #2304

varndellwagglebee opened this issue May 25, 2023 · 2 comments
Labels
customer-reported identify a customer issue question

Comments

@varndellwagglebee
Copy link

Output from azd version
azd version 1.0.0 (commit ed2244c)

Describe the bug
I have added unit testing in my Dockerfile. When I run the docker file locally, I see the test failing. However, I don't see it when it run it in GitHub workflows.

error I see when I run the Dockerfile locally

ERROR [build 14/18] RUN dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx" 6.9s


[build 14/18] RUN dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx":
#22 0.826 Determining projects to restore...
#22 1.558 All projects are up-to-date for restore.
#22 3.427 GlyphEditor.Data.Abstractions -> /src/src/GlyphEditor.Data.Abstractions/bin/Debug/net7.0/GlyphEditor.Data.Abstractions.dll
#22 3.837 GlyphEditor.Data.Postgres -> /src/src/GlyphEditor.Data.Postgres/bin/Debug/net7.0/GlyphEditor.Data.Postgres.dll
#22 4.671 GlyphEditor.Api -> /src/src/GlyphEditor.Api/bin/Debug/net7.0/GlyphEditor.Api.dll
#22 5.114 GlyphEditor.Integration.Tests -> /src/tests/GlyphEditor.Integration.Tests/bin/Debug/net7.0/GlyphEditor.Integration.Tests.dll
#22 5.376 GlyphEditor.Tests -> /src/tests/GlyphEditor.Tests/bin/Debug/net7.0/GlyphEditor.Tests.dll
#22 5.384 Test run for /src/tests/GlyphEditor.Tests/bin/Debug/net7.0/GlyphEditor.Tests.dll (.NETCoreApp,Version=v7.0)
#22 5.483 Microsoft (R) Test Execution Command Line Tool Version 17.6.0 (x64)
#22 5.483 Copyright (c) Microsoft Corporation. All rights reserved.
#22 5.487
#22 5.555 Starting test execution, please wait...
#22 5.582 A total of 1 test files matched the specified pattern.
#22 6.675 Failed Should_upload_file_csv [61 ms]
#22 6.675 Error Message:
#22 6.675 Assert.Fail failed. test failed
#22 6.675 Stack Trace:
#22 6.675 at GlyphEditor.Tests.Storage.AzureBlobStorageTests.Should_upload_file_csv() in /src/tests/GlyphEditor.Tests/Storage/AzureStorageTests.cs:line 36
#22 6.675
#22 6.770 Results File: /src/tests/GlyphEditor.Tests/TestResults/testresults.trx
#22 6.770
#22 6.774 Failed! - Failed: 1, Passed: 20, Skipped: 0, Total: 21, Duration: 786 ms - GlyphEditor.Tests.dll (net7.0)
executor failed running [/bin/sh -c dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx"]: exit code: 1

Error when running deploy from azure.yaml

#22 [build 14/17] RUN dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx"
#22 sha256:c7aef9e1bb3af1422a96faddb3f6968ad28dbe666fbabdd4396f20ecd74cb03a
#22 0.791 Determining projects to restore...
#22 1.573 All projects are up-to-date for restore.
#22 3.452 GlyphEditor.Data.Abstractions -> /src/src/GlyphEditor.Data.Abstractions/bin/Debug/net7.0/GlyphEditor.Data.Abstractions.dll
#22 3.861 GlyphEditor.Data.Postgres -> /src/src/GlyphEditor.Data.Postgres/bin/Debug/net7.0/GlyphEditor.Data.Postgres.dll
#22 4.725 GlyphEditor.Api -> /src/src/GlyphEditor.Api/bin/Debug/net7.0/GlyphEditor.Api.dll
#22 5.227 GlyphEditor.Integration.Tests -> /src/tests/GlyphEditor.Integration.Tests/bin/Debug/net7.0/GlyphEditor.Integration.Tests.dll
#22 5.619 GlyphEditor.Tests -> /src/tests/GlyphEditor.Tests/bin/Debug/net7.0/GlyphEditor.Tests.dll
#22 5.628 Test run for /src/tests/GlyphEditor.Tests/bin/Debug/net7.0/GlyphEditor.Tests.dll (.NETCoreApp,Version=v7.0)
#22 5.729 Microsoft (R) Test Execution Command Line Tool Version 17.6.0 (x64)
#22 5.729 Copyright (c) Microsoft Corporation. All rights reserved.
#22 5.732
#22 5.791 Starting test execution, please wait...
#22 5.817 A total of 1 test files matched the specified pattern.
#22 7.058 Failed Should_upload_file_csv [62 ms]

#22 7.058 Error Message:
#22 7.058 Assert.Fail failed. failed
#22 7.058 Stack Trace:
#22 7.058 at GlyphEditor.Tests.Storage.AzureBlobStorageTests.Should_upload_file_csv() in /src/tests/GlyphEditor.Tests/Storage/AzureStorageTests.cs:line 36
#22 7.058
#22 7.146 Results File: /src/tests/GlyphEditor.Tests/TestResults/testresults.trx
#22 7.146
#22 7.149 Failed! - Failed: 1, Passed: 20, Skipped: 0, Total: 21, Duration: 918 ms - GlyphEditor.Tests.dll (net7.0)
#22 ERROR: executor failed running [/bin/sh -c dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx"]: exit code: 1

To Reproduce
add unit test to a docker file from an asp.net core 7.x project
example docker lines:

RUN dotnet restore "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj"

COPY . .
RUN dotnet build "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" -c Release -o /app/build
RUN dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx"

Expected behavior
I expected to see the following both locally and on GitHub workflow:

ERROR [build 14/18] RUN dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx" 6.9s

[build 14/18] RUN dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx":
#22 0.826 Determining projects to restore...
#22 1.558 All projects are up-to-date for restore.
#22 3.427 GlyphEditor.Data.Abstractions -> /src/src/GlyphEditor.Data.Abstractions/bin/Debug/net7.0/GlyphEditor.Data.Abstractions.dll
#22 3.837 GlyphEditor.Data.Postgres -> /src/src/GlyphEditor.Data.Postgres/bin/Debug/net7.0/GlyphEditor.Data.Postgres.dll
#22 4.671 GlyphEditor.Api -> /src/src/GlyphEditor.Api/bin/Debug/net7.0/GlyphEditor.Api.dll
#22 5.114 GlyphEditor.Integration.Tests -> /src/tests/GlyphEditor.Integration.Tests/bin/Debug/net7.0/GlyphEditor.Integration.Tests.dll
#22 5.376 GlyphEditor.Tests -> /src/tests/GlyphEditor.Tests/bin/Debug/net7.0/GlyphEditor.Tests.dll
#22 5.384 Test run for /src/tests/GlyphEditor.Tests/bin/Debug/net7.0/GlyphEditor.Tests.dll (.NETCoreApp,Version=v7.0)
#22 5.483 Microsoft (R) Test Execution Command Line Tool Version 17.6.0 (x64)
#22 5.483 Copyright (c) Microsoft Corporation. All rights reserved.
#22 5.487
#22 5.555 Starting test execution, please wait...
#22 5.582 A total of 1 test files matched the specified pattern.
#22 6.675 Failed Should_upload_file_csv [61 ms]
#22 6.675 Error Message:
#22 6.675 Assert.Fail failed. test failed
#22 6.675 Stack Trace:
#22 6.675 at GlyphEditor.Tests.Storage.AzureBlobStorageTests.Should_upload_file_csv() in /src/tests/GlyphEditor.Tests/Storage/AzureStorageTests.cs:line 36
#22 6.675
#22 6.770 Results File: /src/tests/GlyphEditor.Tests/TestResults/testresults.trx
#22 6.770
#22 6.774 Failed! - Failed: 1, Passed: 20, Skipped: 0, Total: 21, Duration: 786 ms - GlyphEditor.Tests.dll (net7.0)
executor failed running [/bin/sh -c dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "trx;LogFileName=testresults.trx"]: exit code: 1

Environment
Information on your environment:
*Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.6.1
*Asp.net core 7.x

Additional context
There is not error messages when deploying locally.

Github workflow shows the following:
ERROR: failed building service 'api': failing invoking action 'build', building container: api at .: building image: exit code: 1, stdout: , stderr: ERROR: failed to solve: executor failed running [/bin/sh -c dotnet test "/src/tests/GlyphEditor.Tests/GlyphEditor.Tests.csproj" --logger "console;verbosity=detailed"]: exit code: 1

Error: Process completed with exit code 1.

@ghost ghost added needs-triage For new issues customer-reported identify a customer issue question labels May 25, 2023
@weikanglim
Copy link
Contributor

@varndellwagglebee Thanks for reporting this!

We have #898 planned to include docker build outputs in the console. @vhvb1989 is already working on this.

@weikanglim weikanglim removed the needs-triage For new issues label May 25, 2023
@rajeshkamal5050
Copy link

Closing as a dup of #898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported identify a customer issue question
Projects
None yet
Development

No branches or pull requests

3 participants