0

I have a Microsoft Azure SQL Database project. I also have a Python3.9 project that uses unittest to unit test this database project. I have an Azure DevOps build pipeline defined in YAML that runs the unit test against the development-integration environment.

I do not want to publish changes to the development-integration environment before running the tests. If you think this is the wrong approach, I will consider your arguments.

I want to 'virtually' test the changes. I want to deploy the new objects to a temporary ad-hoc database instance. It must be equivalent to Azure Database Instance. When the tests have been executed I want to clear everything away. I do not want to deploy a database in Azure for this purpose due to billing, although if I were to use a serverless instance this would not be a problem.

Any ideas?

GettingItDone
  • 523
  • 8
  • 26
  • Important note on terminlogy: If your tests interact with a database, they are **not** unit tests. They are integration or system tests. – Daniel Mann Jun 20 '21 at 16:26
  • @Daniel Mann This is a data project (not full stack). The aim is to test that the function and procedure behaviours are consistent. – GettingItDone Jun 20 '21 at 16:30
  • SQL Server 2019 aint that far from Azure SQL DB so you could test against a local instance, Hyper-V VM or Docker container if you have enough RAM. Otherwise your serverless idea isn't a bad one. – wBob Jun 21 '21 at 13:45
  • @wBob I was thinking the same thing. Perhaps have local instances of 2019+ with automatic updates enabled. Or have an update-schedule to keep track of exactly when updates occurred (something like that ...). – GettingItDone Jun 21 '21 at 16:24
  • 1
    Could work if you’re not using any features available in Azure SQL DB not in 2019. – wBob Jun 21 '21 at 16:28

1 Answers1

0

If you are on cloud and you need to test you need to test that on the cloud too.

You cannot "virtually" test, there is nothing equivalent to Azure SQL database on-prem.

Go with the serverless instance as you said.

Francesco Mantovani
  • 10,216
  • 13
  • 73
  • 113