简体   繁体   English

如何在测试任务中分析 azure devops 管道中的超时

[英]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.在我的 azure devops 管道(托管)中,我看到测试任务超时。

The corresponding yaml is对应的 yaml 是

- 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.使用 dotnet core 或使用 .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)如果我在本地运行测试,它们会在几秒钟内完成(以及 DevOps-Server 上的 on.Net-Framework)

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.我在 Azure 上尝试了调试标志,但这对 output 没有任何帮助。

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.作为一种解决方法,我将[Collection("Searching")]添加到我的所有测试类中。 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.但是 yaml 中的/p:ParallelizeTestCollections=false并没有这样做。

As a work around I added [Collection("Searching")] to all of my test classes.作为一种解决方法,我将 [Collection("Searching")] 添加到我的所有测试类中。 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.如果我的代码中存在多线程错误,我想找到并修复它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure DevOps Pipeline 在 NuGet 恢复任务中失败 - Azure DevOps Pipeline failing at NuGet restore task 如何从 Visual Studio 测试任务中设置 Azure DevOps 变量,以便以下内联 PowerShell 脚本可以读取它? - How to set Azure DevOps variable from Visual Studio Test task so the following inline PowerShell script can read it? Azure DevOps 管道中的 XamarinAndroid 任务无故失败 - XamarinAndroid task in Azure DevOps pipeline failing without reason 如何从代码运行 Azure DevOps 管道? - How to run an Azure DevOps pipeline from code? Azure Devops - MSTest - 如果我的单元测试失败,我如何使构建失败,但在集成测试失败时继续(带有警告/通知) - Azure Devops - MSTest - How can I fail a build if my unit tests fail, but continue (with warning/notification) when integration test fail 如何更改 Azure Devops 上的 VSBuild 代理位置? - How can I change the VSBuild agent location on Azure Devops? 如何反序列化 azure devOps 的 json 响应? - How can I deserialize the json response of azure devOps? Azure DevOps 管道部署问题 - Azure DevOps pipeline issue on deploy Azure 用于运行进程的 DevOps 管道 - Azure DevOps pipeline for running processes 作为流水线自动化测试的一部分,有没有办法为每个测试用例使用 Azure DevOps 测试计划参数? - Is there a way to use Azure DevOps Test Plan parameters for each test case as part of automate testing from pipeline?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM