Add cosmos db emulator module#934
Merged
cristianrgreco merged 7 commits intotestcontainers:mainfrom Mar 17, 2025
Merged
Conversation
✅ Deploy Preview for testcontainers-node ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
packages/modules/azurecosmosdb/src/azure-cosmosdb-emulator-container.test.ts
Dismissed
Show dismissed
Hide dismissed
packages/modules/azurecosmosdb/src/azure-cosmosdb-emulator-container.ts
Outdated
Show resolved
Hide resolved
packages/modules/azurecosmosdb/src/azure-cosmosdb-emulator-container.ts
Outdated
Show resolved
Hide resolved
cristianrgreco
approved these changes
Mar 17, 2025
2a5254b to
ff68ca0
Compare
vaernion
pushed a commit
to Arbeidstilsynet/brevgen2
that referenced
this pull request
Dec 3, 2025
….21.0 This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [testcontainers](https://github.com/testcontainers/testcontainers-node) | devDependencies | minor | [`10.20.0` -> `10.21.0`](https://renovatebot.com/diffs/npm/testcontainers/10.20.0/10.21.0) | --- ### Release Notes <details> <summary>testcontainers/testcontainers-node (testcontainers)</summary> ### [`v10.21.0`](https://github.com/testcontainers/testcontainers-node/releases/tag/v10.21.0) [Compare Source](testcontainers/testcontainers-node@v10.20.0...v10.21.0) #### Changes #### 🚀 Features - Add ability to set command flags to Gcloud emulators [@​digital88](https://github.com/digital88) ([#​926](testcontainers/testcontainers-node#926)) - Update resource reaper version [@​loikg](https://github.com/loikg) ([#​933](testcontainers/testcontainers-node#933)) - Add cosmos db emulator module [@​mrtnsch](https://github.com/mrtnsch) ([#​934](testcontainers/testcontainers-node#934)) - Add ability to copy archives into containers [@​zacaj](https://github.com/zacaj) ([#​932](testcontainers/testcontainers-node#932)) #### 🐛 Bug Fixes - Do not replace user-provided Localstack `LAMBDA_DOCKER_FLAGS` [@​florian-nguyen](https://github.com/florian-nguyen) ([#​935](testcontainers/testcontainers-node#935)) #### 🧹 Maintenance - Upgrade linting libraries [@​prenaissance](https://github.com/prenaissance) ([#​931](testcontainers/testcontainers-node#931)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or PR is renamed to start with "rebase!". 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Related work items: #30372
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for the Azure Cosmos DB emulator. Unlike the existing module for Java, .NET, and Python, this implementation uses the new Linux emulator. The old emulator is very slow and cumbersome to work with, and using the new linux-based one seems like a decent tradeoff to make.
The container requires the mapped port to be passed as an env var. I have found a solution to achieve this, but it seems quite hacky to me. I'm very open to other ideas to solve this problem.
The port has to be passed, because CosmosDB provides redirects to the individual write/read endpoints. Those redirects then target the port passed in the env var, defaulting to 8081. The Azure Cosmos SDK client follows these redirects by default, leading to an ECONREFUSED if the port in the env is different than the mapped port.
This could be avoided by disabling endpoint discovery in the client like this:
However, this would force users of this testcontainer to specify different configurations depending on whether their client is running in prod or dev/test.