CI `dotnet test --no-build ` does not run test with 2 parallel jobs

Hi,

i have 2 stages…build and test for building and testing .NET app. In build stage i store all my obj and bin files to artifacts storage so they can be downloaded in the test stage. In the test stage i have 2 jobs for running separate tests.
Since i have all obj and bin files already available i’m using --no-build option with dotnet test tool to make the job faster. Now what’s happening is that one of the jobs doesn’t run any tests. If i modify my CI script (basically comment out either one of the kobs) so it contains only 1 job everything works ok…for both jobs.
The problem occurs when both jobs run parallel. Everything also works if i restrict the runner to be running only 1 concurrent job. It also works if i call dotnet restore prior dotnet test…but this takes additional time.

The job that doesn’t run any tests also doesn’t report any error…it seems as if it doesn’t find any tests to be run.

You’ll need to ensure you’re passing forward the build artifacts between the job stages, as the concurrent execution could mean that a job runs on a separate runner/host. This post may be helpful in implementing a solution: Gitlab CI Test stage after build without rebuilding project - #2 by abagnale

1 Like

Hi, thx for your reply…but as i stated in my original post, i’m already passing the /bin /obj build artifacts between jobs. The question is why one of the jobs doesn’t run the tests if they run in parallel…cause if they run sequentally everything is ok.

Hello Lex.

Could you solve this problem? I’m facing same

Thanks in advance

Hey…no, the problem still persists so in current state, for me to have parallel jobs i have to call dotnet restore for each project containing tests before calling dotnet test…which is not optimal since it takes a lot of time.

for posterity…The problem was in my code. I didn’t control async process (async await) which result in too many unmanaged threads, that works in my VS but not in any container. I fix my code and Gitlab works like a charm!!

In my case the problem is not in the test itself…because test project containing tests doesn’t start at all