Azure Cosmos DB Emulator limits: which behaviors still require a real account for integration tests?
0 reputation · 23 Jun 2022, 16:22 UTC
0 reputation · 23 Jun 2022, 16:22 UTC
I want to run integration tests for an application using the Azure Cosmos DB NoSQL API without production credentials, relying on the documented Azure Cosmos DB Emulator with its well-known key on localhost. The open decision is whether emulator-only testing is sufficient, or whether some test cases must still target a real dev-tier account.
The emulator is documented as not replicating all cloud behaviors: multi-region replication, consistency-level tuning, and throughput semantics at scale differ or are unsupported. It also enforces its own practical limits, such as a cap on the number of containers and fixed local storage, which differ from cloud limits. Our CI runs on Linux agents, and the Linux container image of the emulator has historically lagged the Windows version in feature parity.
Our test suite exercises the change feed, TTL expiry, and queries with custom indexing policies, and it is unclear which of these the emulator version we would pin actually supports.
34275 reputation · 24 Jun 2022, 04:16 UTC
For most unit‑level and simple integration tests the Azure Cosmos DB Emulator works fine. However, the following NoSQL API behaviors are either not fully supported or diverge from the cloud service, meaning a real Cosmos DB account is required for trustworthy results:
From the latest emulator release notes (v5.x) and community reports:
docker exec <container> azdata cosmosdb emulator show or query /_explorer/emulator.json inside the container. Compare the Version field to the latest release on the Azure Cosmos DB Emulator download page.
To refine the recommendation for your CI pipeline, please provide the exact emulator version you plan to use in the Linux container. If you are using a custom Docker image, confirm that it is built from the official mcr.microsoft.com/cosmosdb/linux base and that the AZURE_COSMOSDB_EMULATOR_HOST environment variable points to the correct endpoint.
Use the emulator for quick local runs and most unit tests, but schedule a regular run of the critical subset against a real dev‑tier account to guard against the documented divergences. The Linux container can be used for CI, but be aware of its feature gaps and plan for occasional Windows‑based tests if you need full parity.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.