I'm having an issue running integration tests in Azure Devops. All the tests run locally in a matter of seconds (via dotnet test
or in Visual Studio) but in Devops they time out after an hour.
The YAML for the Devops step looks like this:
steps:
- task: DotNetCoreCLI@2
displayName: 'Run Integration Tests'
inputs:
command: test
projects: |
**/*.IntegrationTests.csproj
!**/obj/**
Looking at the logs the issue seems to occur after the following lines:
A total of 1 test files matched the specified pattern. info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using 'C:\Users\VssAdministrator\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using 'C:\Users\VssAdministrator\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58] Creating key {05e22f2e-8a73-4956-ab90-d0c010ad8b20} with creation date 2019-11-28 13:25:47Z, activation date 2019-11-28 13:25:47Z, and expiration date 2020-02-26 13:25:47Z. info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58] Creating key {af3f23c1-c5a0-4d1c-8502-731a21a06827} with creation date 2019-11-28 13:25:47Z, activation date 2019-11-28 13:25:47Z, and expiration date 2020-02-26 13:25:47Z. info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39] Writing data to file 'C:\Users\VssAdministrator\AppData\Local\ASP.NET\DataProtection-Keys\key---redacted---.xml'. info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39] Writing data to file 'C:\Users\VssAdministrator\AppData\Local\ASP.NET\DataProtection-Keys\key---redacted---.xml'.
I have unit tests that run successfully under a separate step with the same setup (different projects but the same language/framework). My tests use a CustomWebApplicationFactory
with an EF-Core in memory DB - but again locally everything runs in seconds. The project containing the tests is a C# .Net Core 2.2
project.
I am using the Hosted Agent.