More info. I’m able to reproduce the issue when I ssh into a CircleCI build machine.
root@1d2d03c966cf:/REDACTED# dotnet test tests/REDACTED.csproj
Test run for /REDACTEDi/tests/bin/Debug/netcoreapp2.2/REDACTED.Tests.dll(.NETCoreApp,Version=v2.2)
Microsoft ® Test Execution Command Line Tool Version 16.1.0
Copyright © Microsoft Corporation. All rights reserved.
Starting test execution, please wait…
Test run in progress.
It prints “Test run in progress.” once, stalls for about 45s, then completes with positive results but inaccurate timing.
Test Run Successful.
Total tests: 427
Total time: 2.4371 Seconds
The problem is very clearly related to screen output and it’s unique to the CircleCI VM (as far as I can tell).
I can get the tests to execute in ~1 minute when SSH’d in to the box with this:
dotnet test -v n --no-build --no-restore
I can get the tests to execute in ~5s (normal time!) with this:
x=$(dotnet test -v -n); echo $x;
The output is terrible, but it works. Difference in total execution time is ~50s (using -v n to get total exec time).
So… If anyone needs a workaround, that’s it. Hide the output from CircleCI by executing the tests in a subshell.
This is the bash script I’m using for a workaround. Adjust to suit your testing needs… hope it helps.
hack=(dotnet test -v m --no-build --no-restore)
if [ ? -ne 0 ]; then