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

Test execution sometimes hangs when running in Azure DevOps using dotnet test #1207

Open
stevozilik opened this issue Aug 29, 2024 · 3 comments

Comments

@stevozilik
Copy link

stevozilik commented Aug 29, 2024

Hi,

I've been experiencing NUnit tests getting stuck when running in Azure Devops yml pipeline using the dotnet test ... command

Background:

  • NUnit 4.1.0 (same behavior with previous versions)
  • NUnit3TestAdapter 4.6.0 (same behavior with previous versions)
  • Microsoft.NET.Test.Sdk 17.11.0 (same behavior with previous versions)
  • .Net 8
  • Azure DevOps running on ubuntu-latest or windows-latest (no difference)
  • SpecFlow.NUnit 3.9.74

Observed Behavior (test logs):

  • Test execution sometimes stops after one of the tests (inconsistent) and never completes. This is the log:
    ... legitimate test logs ...
    2024-08-29T13:55:41.6129069Z -> duration: ScenarioHooks.AfterScenario(): 1.0s
    2024-08-29T13:55:41.7389440Z
    **** Expected log line with the test outcome, observed in previous tests, consistently missing when the tests get stuck ***
    (missing) 2024-08-29T13:55:41.6858716Z Passed TestName [1 s]

    **** [note the time gap below, cancellation triggered by the job.timeoutInMinutes] ***
    2024-08-29T14:00:28.8388057Z ##[error]The Operation will be canceled. The next steps may not contain expected logs.
    2024-08-29T14:00:28.8557105Z ##[error]The operation was canceled.
    2024-08-29T14:00:28.8560745Z ##[section]Finishing: Running Tests

It looks like something gets stuck and I'm struggling to figure out where to even begin

similar dotnet test ... command testing the same assembly locally works consistently ok

I'd like to ask for help how to diagnose this to get to the bottom of why it gets stuck

I've tried adding --verbosity diag --logger "console;verbosity=detailed" -- "NUnit.Consoleout=1 NUnit.InternalTraceLevel=Debug NUnit.Verbosity=5" to the dotnet test ... command but nothing jumps out as helpful

@dragojs
Copy link

dragojs commented Nov 4, 2024

Started experiencing exactly this some time ago and couldn't find the problem either.
Gonna try to dump the logs in a file next run and see what I find

@OsirisTerje
Copy link
Member

Sorry for not commenting on this earlier.

This is very hard to give any helpful comment on, there is too little information to go on.

Some questions:

Does the issue remain if you reduce the code to a single test (or just a few)?
See the Specflow is involved. Does the same happens without specflow?
Does it work locally ?
Have you enabled the dumps in the NUnit3TestAdapter (see config options for a runsettings file)
Have you checked the different possible timeout values and are you within those limits?
Can you produce a repro solution ?
Enabling diagnostic logs as you mention is a very good idea.

@dragojs
Copy link

dragojs commented Nov 4, 2024

Thank you for commenting as early as you did.
Very good questions all of them, I am going to try and come back with a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@OsirisTerje @stevozilik @dragojs and others