简体   繁体   中英

How can I analyze a timeout in a azure devops pipeline in test task

In my azure devops pipeline (hosted) I'm seeing a timeout in the test-task.

The corresponding yaml is

- task: DotNetCoreCLI@2
  displayName: 'dotnet test'
  inputs:
    command: test
    projects: '**/*.sln'
    arguments: '-v n /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ParallelizeTestCollections=false'

The timeout is occuring when the tests are executed with dotnet core or with.Net Framework. (They have two target frameworks).

If I run the tests locally they complete in a few seconds (and on.Net-Framework on the DevOps-Server too)

I think it's a deadlock inside the tests but I can't find any hint how to analyze this deadlock.

Is there a possibility to get the memory-dump of the test process when the timeout occures? I tried the debug-flag on Azure but this didn't output anything that helped me.

These are the last lines in the task-logs:

Test run for d:\a\1\s\MyCompany.Searching.Tests\bin\Debug\netcoreapp3.1\win7-x64\MyCompany.Searching.Tests.dll(.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.6.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.2+2d84eb3141 (64-bit .NET Core 3.1.5)
[xUnit.net 00:00:01.14]   Discovering: MyCompany.Searching.Tests
[xUnit.net 00:00:01.50]   Discovered:  MyCompany.Searching.Tests
[xUnit.net 00:00:01.50] MyCompany.Searching.Tests: Skipping test case with duplicate ID '7b88604fa90df0e95e130fc06b3acd3a8c4f9267' ('MyCompany.Searching.Tests.Fields.DateAndTimeTest.TestMatch(search: "30.09.2018", expected: ["1", "2", "3"])' and 'MyCompany.Searching.Tests.Fields.DateAndTimeTest.TestMatch(search: "30.09.2018", expected: ["1", "2", "3"])')
[xUnit.net 00:00:01.50] MyCompany.Searching.Tests: Skipping test case with duplicate ID '7b88604fa90df0e95e130fc06b3acd3a8c4f9267' ('MyCompany.Searching.Tests.Fields.DateAndTimeTest.TestMatch(search: "30.09.2018", expected: ["1", "2", "3"])' and 'MyCompany.Searching.Tests.Fields.DateAndTimeTest.TestMatch(search: "30.09.2018", expected: ["1", "2", "3"])')
[xUnit.net 00:00:01.50] MyCompany.Searching.Tests: Skipping test case with duplicate ID 'e5a229256a7d594e50105659370af9bc179b7fc4' ('MyCompany.Searching.Tests.Fields.GermanFullTextTest.TestStringMatchWords(search: "grosse Leuchte", expectedWords: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...], expectedNgrams: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...])' and 'MyCompany.Searching.Tests.Fields.GermanFullTextTest.TestStringMatchWords(search: "grosse Leuchte", expectedWords: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...], expectedNgrams: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...])')
[xUnit.net 00:00:01.50] MyCompany.Searching.Tests: Skipping test case with duplicate ID 'ef6d0e06fe061293ddaa576122e2a955dc41fa84' ('MyCompany.Searching.Tests.Fields.GermanFullTextTest.TestStringMatchWords(search: "grosse Klasse", expectedWords: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...], expectedNgrams: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...])' and 'MyCompany.Searching.Tests.Fields.GermanFullTextTest.TestStringMatchWords(search: "grosse Klasse", expectedWords: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...], expectedNgrams: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...])')
[xUnit.net 00:00:01.50] MyCompany.Searching.Tests: Skipping test case with duplicate ID '6f439b06f22861b65ffde3549b020d4aec3e5e42' ('MyCompany.Searching.Tests.Fields.GermanFullTextTest.TestStringMatchNgrams(search: "grosse Leuchte", expectedWords: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...], expectedNgrams: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...])' and 'MyCompany.Searching.Tests.Fields.GermanFullTextTest.TestStringMatchNgrams(search: "grosse Leuchte", expectedWords: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...], expectedNgrams: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...])')
[xUnit.net 00:00:01.50] MyCompany.Searching.Tests: Skipping test case with duplicate ID 'a98581450c7a4b65735e16fbddfea5fc3dfa4fca' ('MyCompany.Searching.Tests.Fields.GermanFullTextTest.TestStringMatchNgrams(search: "grosse Klasse", expectedWords: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...], expectedNgrams: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...])' and 'MyCompany.Searching.Tests.Fields.GermanFullTextTest.TestStringMatchNgrams(search: "grosse Klasse", expectedWords: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...], expectedNgrams: ["Eine kleine oder große Feuchtraumleuchte im Keller"..., "Eine Raumleuchte für kleine oder große Kellerräume"...])')
[xUnit.net 00:00:01.50]   Starting:    MyCompany.Searching.Tests
Attempting to cancel the build...
Attempting to cancel the build...
##[error]The task has timed out.
Finishing: dotnet test

As a work around I added [Collection("Searching")] to all of my test classes. Now it's running.

This isn't a solution in my opinion. I want to execute the tests in parallel locally and on the server.

And if there is a multi threading bug in my code I want to find and fix it.

On the other hand it will also be possible to disable parallel execution of all tests on the server. But the /p:ParallelizeTestCollections=false in the yaml doesn't do this.

As a work around I added [Collection("Searching")] to all of my test classes. Now it's running. This isn't a solution in my opinion. I want to execute the tests in parallel locally and on the server. And if there is a multi threading bug in my code I want to find and fix it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM