Klaus Even Enevoldsen
Klaus Even Enevoldsen

Reputation: 76

Functioning fake for Cosmos DB SQL API

I am maintaining a large system that I did not design or build myself. The system has exceptionally large files and services. Unit testing is extremely hard to write without splitting the services into smaller units, which do only one thing.

Now, the system comes with a series of integration tests that use the Cosmos DB Emulator. It takes about 8 minutes to start the Cosmos DB Emulator on the CI-pipeline and we must run the tests in sequence. All together the process takes more than 15 minutes which I think is unacceptable.

I am looking for a functional fake for Cosmos DB (SQL API) to use instead of the emulator. I would like to avoid writing the code myself, but a few Google-searches returned nothing usable.

PS. We have spent a lot of time trying to optimize the CI-pipeline.

Upvotes: 2

Views: 1035

Answers (2)

Klaus Even Enevoldsen
Klaus Even Enevoldsen

Reputation: 76

We created a fake storage layer that stores the test data in memory and went from 7 minutes to 14 seconds to run the tests. I am happy.

Upvotes: 1

Kartik Bhiwapurkar
Kartik Bhiwapurkar

Reputation: 5167

Kindly take note that there is no such Functioning fake Cosmos DB for SQL API development and testing. You can do development and testing through Cosmos DB emulator without network and with free of cost.

There are various other cost optimization options for development and testing: -

Try Azure Cosmos DB for free -> Azure Cosmos DB free tier -> Azure free account -> Cosmos DB serverless -> shared throughput databases

If it is taking too long time to open, you can start it automatically, when you turn on your computer.

Steps: - 1. Open task scheduler 2. create task 3. create trigger 4. set Action

You can surely refer this document article stated below by @Alberto De Natale for scheduling tasks for starting cosmos DB emulator.

https://thegreenerman.medium.com/azure-cosmos-db-emulator-auto-start-it-when-you-boot-your-pc-without-docker-4f72dd2f1ca8

Upvotes: 1

Related Questions