Why my tests with localdb works fine in Azure DevOps?
Asked Answered
B

1

7

I use Azure DevOps for CI process of my .NET Core app. Also I use integration tests based on localDb SQL database. When I run my ci piplene I was surprised that all tests were passed.

{
      "UseInMemoryDatabase": false, // Application.IntegrationTests are not designed to work with InMemory database.
      "DeveloperPathSqlConnectionString": "Server=(localdb)\\mssqllocaldb;Database=DeveloperPathTestDb;Trusted_Connection=True;MultipleActiveResultSets=true;",
      "Key": {
        "Type": "Development"
      },
      "Logging": {
        "LogLevel": {
          "Default": "Debug",
          "System": "Information",
          "Microsoft": "Information"
        }
      }
    }

Does Azure DevOps already contain the localdb?

Bignoniaceous answered 30/4, 2021 at 19:19 Comment(1)
Yes, if you use the Windows latest agentTruthful
A
10

Does Azure DevOps already contain the localdb?

The answer is yes.

The windows image contain the localdb. The hosted windows agent comes with Visual Studio which includes LocalDB.

You could use following start command to verify:

pool:
  vmImage: 'windows-latest'


- task: PowerShell@2
  displayName: 'start mssqllocaldb'
  inputs:
    targetType: 'inline'
    script: 'sqllocaldb start mssqllocaldb'

The test result:

enter image description here

Andorra answered 3/5, 2021 at 7:33 Comment(2)
The link you provided is for runner-images from github actions and the question was for Azure DevOps pipeline. I am a bit confuesd. Are those images the same for both providers or what?Priesthood
They are the same.Toandfro

© 2022 - 2024 — McMap. All rights reserved.