forked from testcontainers/testcontainers-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Master #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Master #1
Conversation
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
#557 - trying to solve this issue by adding types. --------- Co-authored-by: Dandiggas <[email protected]>
Ref #562 This enhancement adds capability to utilize the env var `DOCKER_AUTH_CONFIG` in-order to login to a private docker registry. --------- Co-authored-by: David Ankin <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [4.5.0](testcontainers-v4.4.1...testcontainers-v4.5.0) (2024-05-25) ### Features * **core:** Private registry ([#566](#566)) ([59fbcfa](59fbcfa)) ### Bug Fixes * added types to exec & tc_properties_get_tc_host ([#561](#561)) ([9eabb79](9eabb79)) * on windows, DockerCompose.get_service_host returns an unusable "0.0.0.0" - adjust to 127.0.0.1 ([#457](#457)) ([2aa3d37](2aa3d37)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Just a .gitattributes file to checkout .sh files with LF line ending for people coming from Windows world. --------- Co-authored-by: David Ankin <[email protected]>
With the option to import keycloak realms, introduced with #565, the[_configure()](https://github.com/testcontainers/testcontainers-python/blob/78b6f0ecb15e8cba687eb4588c5ce19ca32208bc/modules/keycloak/testcontainers/keycloak/__init__.py#L57) method is called twice. Once it is called in the [start()](https://github.com/testcontainers/testcontainers-python/blob/78b6f0ecb15e8cba687eb4588c5ce19ca32208bc/modules/keycloak/testcontainers/keycloak/__init__.py#L83) method of keycloak itself and then it is called a second time in the [start()](https://github.com/testcontainers/testcontainers-python/blob/78b6f0ecb15e8cba687eb4588c5ce19ca32208bc/core/testcontainers/core/container.py#L90) method of DockerContainer. This wasn't an issue so far. But if a realm shall be imported (self.has_realm_import in keycloak is True), then every time the string " --import-realm" is added to the start command in the _configure() method. The keycloak container won't start if "--import-realm" is specified multiple times. This is probably the easiest solution to solve the issue. If wished, I can also work on a more robust solution, e.g. by storing the start command in a list and checking that "--import-realm" is only added once. Co-authored-by: Sebastian Scholz <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [4.5.1](testcontainers-v4.5.0...testcontainers-v4.5.1) (2024-05-31) ### Bug Fixes * **k3s:** add configuration parameter for disabling cgroup mount to avoid "unable to apply cgroup configuration" ([#592](#592)) ([8917772](8917772)) * **keycloak:** realm import ([#584](#584)) ([111bd09](111bd09)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
As part of the effort described, detailed and presented on #559 (Providing the implementation for #83 - Docker file support and more) This is the first PR (out of 4) that should provide all the groundwork to support image build. This would allow users to use custom images: ```python with DockerImage(path=".") as image: with DockerContainer(str(image)) as container: # Test something with/on custom image ``` Next in line is: `feat(core): Added SrvContainer` And later on: `feat(core): Added FastAPI module` `feat(core): Added AWS Lambda module` (all of the above can be overviewed on #559)
Following #566 - Private registry, adding the relevant doc so the usage will be clear and (hopefully) reachable.
Make the Readme display some more details regarding the project: - using ruff (just a nice reference) - pypi version (good visibility) - license (good visibility) - supported python versions (good visibility) - code coverage reporting (main driver for this PR)  Relates to #544 - export code coverage (e.g. to codecov)
Fix some issues with the private registry instructions: - issue with the link to official documentation - convert all relevant blocks to code-block - fix some typos
I use this wonderful package for writing tests, but I did not find a container for [Milvus vector database](https://milvus.io/docs) Please check, I'm ready to correct comments --------- Co-authored-by: ivan <[email protected]> Co-authored-by: David Ankin <[email protected]>
This PR is adding a new MosquittoContainer class that helps creating integration tests for MQTT clients. The MosquittoContainer class contains a bunch of methods to help with testing: * checking number of messages received * watching topics * check last payload published on a particular topic * etc This PR lacks tests. I can add them if there is interest in this PR... --------- Co-authored-by: Dave Ankin <[email protected]>
As part of the effort described, detailed and presented on #559 This is the seconds PR (out of 4) that should provide all the groundwork to support containers running a server. This would allow users to use custom images: ```python with DockerImage(path=".", tag="test:latest") as image: with ServerContainer(port=9000, image=image) as srv: # Test something with/on the server using port 9000 ``` Next in line are: `feat(core): Added FastAPI module` `feat(core): Added AWS Lambda module` --- Based on the work done on #585 Expended from issue #83 --------- Co-authored-by: David Ankin <[email protected]>
Adds [Cockroach DB] (https://www.cockroachlabs.com/) module to use with Test containers I had done this previously under #281, but opted to just redo it rather than try to rebase all the things. - [x] Create a new feature directory and populate it with the package structure [described in the documentation](https://testcontainers-python.readthedocs.io/en/latest/#package-structure). Copying one of the existing features is likely the best way to get started. - [x] Implement the new feature (typically in `__init__.py`) and corresponding tests. - [x] Update the feature `README.rst` and add it to the table of contents (`toctree` directive) in the top-level `README.rst`. - [] Add a line `[feature name]` to the list of components in the GitHub Action workflow in `.github/workflows/main.yml` to run tests, build, and publish your package when pushed to the `main` branch. - [x] Rebase your development branch on `main` (or merge `main` into your development branch). - [x] Add Package to pyproject.toml - [ ] Add a line `-e file:[feature name]` to `requirements.in` and open a pull request. Opening a pull request will automatically generate lock files to ensure reproducible builds (see the [pip-tools documentation](https://pip-tools.readthedocs.io/en/latest/) for details). Finally, run `python get_requirements.py --pr=[your PR number]` to fetch the updated requirement files (the build needs to have succeeded). --------- Co-authored-by: joelhess <[email protected]> Co-authored-by: David Ankin <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [4.6.0](testcontainers-v4.5.1...testcontainers-v4.6.0) (2024-06-18) ### Features * **core:** Added ServerContainer ([#595](#595)) ([0768490](0768490)) * **core:** Image build (Dockerfile support) ([#585](#585)) ([54c88cf](54c88cf)) ### Bug Fixes * Add Cockroach DB Module to Testcontainers ([#608](#608)) ([4aff679](4aff679)) * Container for Milvus database ([#606](#606)) ([ec76df2](ec76df2)) * move TESTCONTAINERS_HOST_OVERRIDE to config.py ([#603](#603)) ([2a5a190](2a5a190)), closes [#602](#602) * **mqtt:** Add mqtt.MosquittoContainer ([#568](#568)) ([#599](#599)) ([59cb6fc](59cb6fc)) ### Documentation * **main:** Private registry ([#598](#598)) ([9045c0a](9045c0a)) * Update private registry instructions ([#604](#604)) ([f5a019b](f5a019b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Following a similar strategy as several other testcontainers
implementations, this PR introduces the possibility to run Kafka in
KRAft mode.
```py
with KafkaContainer().with_kraft() as container:
# Test something with/on KRaft mode
```
- Added a new class OllamaContainer with few methods to handle the Ollama container. - The `_check_and_add_gpu_capabilities` method checks if the host has GPUs and adds the necessary capabilities to the container. - The `commit_to_image` allows to save somehow the state of a container into an image so that we can reuse it, especially for the ones having some models pulled. - Added tests to check the functionality of the new class. > Note: I inspired myself from the java implementation of the Ollama module. Fixes #617 --------- Co-authored-by: David Ankin <[email protected]>
… (does not stop the other services) (#620) The command would otherwise stop/down all services, not just the services the instance itself started. Useful for e.g. one fixture per service, and you want different scopes for the services.
# change Document how to contribute, with initial focus on making local development smooth. # Tasks - [x] Finish the `new-container` guide - [x] Remove any old docs referring to - [x] Update `README.md` to point at the contribution guide - [x] Update `README.md` to add badges (supported python versions, etc) and to give kudos to current and past maintainers and contributors --------- Co-authored-by: Dave Ankin <[email protected]> Co-authored-by: Jan Katins <[email protected]> Co-authored-by: Max Pfeiffer <[email protected]>
As part of the effort described, detailed and presented on #559 This is the third PR (out of 4) that should provide all the groundwork to support containers running a server. As discussed on #595 this PR aims to refactor the `ServerContainer` under a new dedicated module called "generic".  The idea is that this module could include multiple generic implementations such as ```server.py``` with the proper documentation and examples to allow users simpler usage and QOL. This PR adds the original FastAPI implementation as a simple doc example, I think this aligns better following #595 Next in line is ```feat(core): Added AWS Lambda module``` Based on the work done on #585 and #595 Expended from issue #83 --- Please note an extra commit is included to simulate the relations when importing between and with other modules.
Adds support for the [CosmosDB Emulator container](https://learn.microsoft.com/en-us/azure/cosmos-db/emulator) --------- Co-authored-by: Mehdi BEN ABDALLAH <@mbenabda> Co-authored-by: David Ankin <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [4.7.0](testcontainers-v4.6.0...testcontainers-v4.7.0) (2024-06-28) ### Features * **core:** Added Generic module ([#612](#612)) ([e575b28](e575b28)) * **core:** allow custom dockerfile path for image build and bypassing build cache ([#615](#615)) ([ead0f79](ead0f79)), closes [#610](#610) * **core:** DockerCompose.stop now stops only services that it starts (does not stop the other services) ([#620](#620)) ([e711800](e711800)) ### Bug Fixes * **ollama:** Add support for ollama module ([#618](#618)) ([5442d05](5442d05)) * **cosmosdb:** Add support for the CosmosDB Emulator ([#579](#579)) ([8045a80](8045a80)) * improve ollama docs, s/ollama_dir/ollama_home/g ([#619](#619)) ([27f2a6b](27f2a6b)) * **kafka:** Add Kraft to Kafka containers ([#611](#611)) ([762d2a2](762d2a2)) ### Documentation * **contributing:** add contribution and new-container guide ([#460](#460)) ([3519f4b](3519f4b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# New Container Fixes #626 # PR Checklist - [x] Your PR title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) syntax as we make use of this for detecting Semantic Versioning changes. - [x] Your PR allows maintainers to edit your branch, this will speed up resolving minor issues! - [x] The new container is implemented under `modules/*` - Your module follows [PEP 420](https://peps.python.org/pep-0420/) with implicit namespace packages (if unsure, look at other existing community modules) - Your package namespacing follows `testcontainers.<modulename>.*` and you DO NOT have an `__init__.py` above your module's level. - Your module has it's own tests under `modules/*/tests` - Your module has a `README.rst` and hooks in the `.. auto-class` and `.. title` of your container - Implement the new feature (typically in `__init__.py`) and corresponding tests. - [x] Your module is added in `pyproject.toml` - it is declared under `tool.poetry.packages` - see other community modules - it is declared under `tool.poetry.extras` with the same name as your module name, we still prefer adding _NO EXTRA DEPENDENCIES_, meaning `mymodule = []` is the preferred addition (see the notes at the bottom) - [x] (seems to not be needed anymore) The `INDEX.rst` at the project root includes your module under the `.. toctree` directive - [x] Your branch is up to date (or we'll use GH's "update branch" function through the UI) --------- Co-authored-by: Dave Ankin <[email protected]>
Following #612, updated the test module import with a better name and some minor fixes.
# New Container Fixes #628 # PR Checklist - [x] Your PR title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) syntax as we make use of this for detecting Semantic Versioning changes. - [x] Your PR allows maintainers to edit your branch, this will speed up resolving minor issues! - [x] The new container is implemented under `modules/*` - Your module follows [PEP 420](https://peps.python.org/pep-0420/) with implicit namespace packages (if unsure, look at other existing community modules) - Your package namespacing follows `testcontainers.<modulename>.*` and you DO NOT have an `__init__.py` above your module's level. - Your module has it's own tests under `modules/*/tests` - Your module has a `README.rst` and hooks in the `.. auto-class` and `.. title` of your container - Implement the new feature (typically in `__init__.py`) and corresponding tests. - [x] Your module is added in `pyproject.toml` - it is declared under `tool.poetry.packages` - see other community modules - it is declared under `tool.poetry.extras` with the same name as your module name, we still prefer adding _NO EXTRA DEPENDENCIES_, meaning `mymodule = []` is the preferred addition (see the notes at the bottom) - [x] ~The `INDEX.rst` at the project root includes your module under the `.. toctree` directive~ - [x] Your branch is up to date (or we'll use GH's "update branch" function through the UI)
… to be automatically cleaned up (#627) (#630) This PR adds `create` method to the `Network` class to enable a non-context-manager usage. Fixes #627 --------- Co-authored-by: Dave Ankin <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [4.7.1](testcontainers-v4.7.0...testcontainers-v4.7.1) (2024-07-02) ### Bug Fixes * **core:** bad rebase from [#579](#579) ([#635](#635)) ([4766e48](4766e48)) * **modules:** Mailpit Container ([#625](#625)) ([0b866ff](0b866ff)) * **modules:** SFTP Server Container ([#629](#629)) ([2e7dbf1](2e7dbf1)) * **network:** Now able to use Network without context, and has labels to be automatically cleaned up ([#627](#627)) ([#630](#630)) ([e93bc29](e93bc29)) * **postgres:** get_connection_url(driver=None) should return postgres://... ([#588](#588)) ([01d6c18](01d6c18)), closes [#587](#587) * update test module import ([#623](#623)) ([16f6ca4](16f6ca4)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Minimal change to expose some helper methods on the `MailpitContainer`
… fields in DOCKER_AUTH_CONFIG) (#647) Continuing #562, got some feedback regarding an issue with unsupported use cases. In this PR we will try to: 1. Map the use cases 2. Raise a warning regarding unsupported uses cases (hopefully they will be added later) 3. Address/Fix the issue where unsupported JSON schema for `DOCKER_AUTH_CONFIG` leads to an error As always any feedback will be much appreciated. _Please note this PR does not implement all use-cases just does a better job at preparing and handling them for now_
🤖 I have created a release *beep* *boop* --- ## [4.7.2](testcontainers-v4.7.1...testcontainers-v4.7.2) (2024-07-15) ### Bug Fixes * Add container Trino ([#642](#642)) ([49ce5a5](49ce5a5)), closes [#641](#641) * **core:** Improve private registry support (tolerate not implemented fields in DOCKER_AUTH_CONFIG) ([#647](#647)) ([766c382](766c382)) * **kafka:** add a flag to limit to first hostname for use with networks ([#638](#638)) ([0ce4fec](0ce4fec)), closes [#637](#637) * **modules:** Mailpit container base API URL helper method ([#643](#643)) ([df07586](df07586)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
As part of the effort described, detailed and presented on #559 This is the 4th (and final in this track) PR that should provide support for AWS Lambda containers. This module will add the ability to test and run Amazon Lambdas (using the built-in runtime interface emulator) For example: ```python from testcontainers.aws import AWSLambdaContainer from testcontainers.core.waiting_utils import wait_for_logs from testcontainers.core.image import DockerImage with DockerImage(path="./modules/aws/tests/lambda_sample", tag="test-lambda:latest") as image: with AWSLambdaContainer(image=image, port=8080) as func: response = func.send_request(data={'payload': 'some data'}) assert response.status_code == 200 assert "Hello from AWS Lambda using Python" in response.json() delay = wait_for_logs(func, "START RequestId:") ``` This can (and probably will) be used with the provided [LocalStackContainer](https://testcontainers-python.readthedocs.io/en/latest/modules/localstack/README.html) to help simulate more advance AWS cases. --- Based on the work done on: - #585 - #595 - #612 Expended from issue #83
Adds a `vhost` parameter to the RabbitMQContainer constructor that allows the `RABBITMQ_DEFAULT_VHOST` [environment variable](https://www.rabbitmq.com/docs/configure#supported-environment-variables) to be modified. Subsequently `vhost` is then also used inside the `get_connection_params` method for the `pika` connection parameters, which is used to test if the container is ready.
…659) # changes On fiddling with a local project of mine, I realised we default to removing volumes when using compose. This is neat, but the context manager should also allow control over the volumes kept. This change adds the `keep_volumes` flag and hooks into `self.stop()` that already had the option. I added a test to cover the new functionality :
This PR add a new function to the `testcontainers.compose.DockerComposer` class, `get_config` which use `docker compose config` command for resolving and returning the actual docker compose configuration. This can be useful for example if you want to retrieve a connection string you pass to your app in your docker compose in order to connect to your database service instead of copy pasting it from your compose file into your tests. Also note thats its way easier to rely on docker compose config to get you the config than trying to manually find, read and merge compose files in specified context (I tried it first ...). About the tests I mostly ensured the docker compose command was as expected. This is because the config produced by the docker compose can not always reflect exactly what is in the file. There is some normalization/resolving which is done (even when you pass all flags to disable them). But anyway, I'm not sure its a good idea to actually test the behavior of the docker config command itself. Let me know what you think of it! --------- Co-authored-by: David Ankin <[email protected]>
fixes #645 - network should be attached as the container is started, not as a post-start action. This will make sure port binding and exposing works correctly. --------- Signed-off-by: mgorsk1 <[email protected]>
This add the support for those cassandra based dbs and their drivers, cassandra-driver, scylla-driver Ref: https://cassandra.apache.org/ Ref: https://www.scylladb.com/ Ref: https://pypi.org/project/cassandra-driver/ Ref: https://pypi.org/project/scylla-driver/ --------- Co-authored-by: David Ankin <[email protected]>
…ed for cassandra module test run? (#680) cleanup after incorrect decision made on scylla pr rebase
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.
No description provided.