-
Notifications
You must be signed in to change notification settings - Fork 297
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
fix(mongodb): waiting for container to start (it was not waiting at all before?) #461
Merged
Conversation
This file contains 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
alexanderankin
changed the title
Fix MongoDB waiting (it was not waiting at all before?)
fix(mongodb): waiting for container to start (it was not waiting at all before?)
Mar 9, 2024
bearrito
pushed a commit
to bearrito/testcontainers-python
that referenced
this pull request
Mar 9, 2024
…ll before?) (testcontainers#461) we were using this code to test if it was online or not:`MongoClient(self.get_connection_url())`, but that doesn't actually perform any connection, instead you have to do something like: ```python @wait_container_is_ready() def _connect(self): client = self.get_connection_client() # will raise pymongo.errors.ServerSelectionTimeoutError if no connection is established client.admin.command('ismaster') ``` thanks to @smparekh for pointing this out, in his PR: https://github.com/testcontainers/testcontainers-python/pull/80/files#diff-cf09f76f44db0af04c58ddb456ccae39f7e29ce1d9208acd5f514c0a7dccb646R78 this PR implements the workaround described in the PR: ```python @pytest.fixture(scope="session") def test_client(): # init mongo mongo_container = MongoDbContainer("mongo:4").start() wait_for_logs(mongo_container, 'waiting for connections on port 27017') ... Co-authored-by: Shaishav Parekh <sparekh@oneweb.net>
alexanderankin
added a commit
that referenced
this pull request
Mar 11, 2024
🤖 I have created a release *beep* *boop* --- ## [4.0.1](testcontainers-v4.0.0...testcontainers-v4.0.1) (2024-03-11) ### Features * **postgres:** Remove SqlAlchemy dependency from postgres container ([#445](#445)) ([f30eb1d](f30eb1d)) ### Bug Fixes * **clickhouse:** clickhouse waiting ([#428](#428)) ([902a5a3](902a5a3)) * Close docker client when stopping the docker container ([#380](#380)) ([efb1683](efb1683)) * failing tests for elasticsearch on machines with ARM CPU ([#454](#454)) ([701b23a](701b23a)) * **mongodb:** waiting for container to start (it was not waiting at all before?) ([#461](#461)) ([2c4f171](2c4f171)) * unclosed socket warning in db containers ([#378](#378)) ([cd90aa7](cd90aa7)) * Update the copyright header for readthedocs ([#341](#341)) ([5bef18a](5bef18a)) --- 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> Co-authored-by: David Ankin <daveankin@gmail.com>
alexanderankin
added a commit
that referenced
this pull request
Mar 11, 2024
🤖 I have created a release *beep* *boop* --- ## [4.0.1](testcontainers-v4.0.0...testcontainers-v4.0.1) (2024-03-11) ### Features * **postgres:** Remove SqlAlchemy dependency from postgres container ([#445](#445)) ([f30eb1d](f30eb1d)) ### Bug Fixes * **clickhouse:** clickhouse waiting ([#428](#428)) ([902a5a3](902a5a3)) * Close docker client when stopping the docker container ([#380](#380)) ([efb1683](efb1683)) * failing tests for elasticsearch on machines with ARM CPU ([#454](#454)) ([701b23a](701b23a)) * go back to 4.0.1 ([#465](#465)) ([1ac8c24](1ac8c24)) * **mongodb:** waiting for container to start (it was not waiting at all before?) ([#461](#461)) ([2c4f171](2c4f171)) * unclosed socket warning in db containers ([#378](#378)) ([cd90aa7](cd90aa7)) * Update the copyright header for readthedocs ([#341](#341)) ([5bef18a](5bef18a)) --- 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> Co-authored-by: David Ankin <daveankin@gmail.com>
This was referenced Mar 11, 2024
bearrito
pushed a commit
to bearrito/testcontainers-python
that referenced
this pull request
Mar 30, 2024
🤖 I have created a release *beep* *boop* --- ## [4.0.1](testcontainers/testcontainers-python@testcontainers-v4.0.0...testcontainers-v4.0.1) (2024-03-11) ### Features * **postgres:** Remove SqlAlchemy dependency from postgres container ([testcontainers#445](testcontainers#445)) ([f30eb1d](testcontainers@f30eb1d)) ### Bug Fixes * **clickhouse:** clickhouse waiting ([testcontainers#428](testcontainers#428)) ([902a5a3](testcontainers@902a5a3)) * Close docker client when stopping the docker container ([testcontainers#380](testcontainers#380)) ([efb1683](testcontainers@efb1683)) * failing tests for elasticsearch on machines with ARM CPU ([testcontainers#454](testcontainers#454)) ([701b23a](testcontainers@701b23a)) * **mongodb:** waiting for container to start (it was not waiting at all before?) ([testcontainers#461](testcontainers#461)) ([2c4f171](testcontainers@2c4f171)) * unclosed socket warning in db containers ([testcontainers#378](testcontainers#378)) ([cd90aa7](testcontainers@cd90aa7)) * Update the copyright header for readthedocs ([testcontainers#341](testcontainers#341)) ([5bef18a](testcontainers@5bef18a)) --- 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> Co-authored-by: David Ankin <daveankin@gmail.com>
bearrito
pushed a commit
to bearrito/testcontainers-python
that referenced
this pull request
Mar 30, 2024
🤖 I have created a release *beep* *boop* --- ## [4.0.1](testcontainers/testcontainers-python@testcontainers-v4.0.0...testcontainers-v4.0.1) (2024-03-11) ### Features * **postgres:** Remove SqlAlchemy dependency from postgres container ([testcontainers#445](testcontainers#445)) ([f30eb1d](testcontainers@f30eb1d)) ### Bug Fixes * **clickhouse:** clickhouse waiting ([testcontainers#428](testcontainers#428)) ([902a5a3](testcontainers@902a5a3)) * Close docker client when stopping the docker container ([testcontainers#380](testcontainers#380)) ([efb1683](testcontainers@efb1683)) * failing tests for elasticsearch on machines with ARM CPU ([testcontainers#454](testcontainers#454)) ([701b23a](testcontainers@701b23a)) * go back to 4.0.1 ([testcontainers#465](testcontainers#465)) ([1ac8c24](testcontainers@1ac8c24)) * **mongodb:** waiting for container to start (it was not waiting at all before?) ([testcontainers#461](testcontainers#461)) ([2c4f171](testcontainers@2c4f171)) * unclosed socket warning in db containers ([testcontainers#378](testcontainers#378)) ([cd90aa7](testcontainers@cd90aa7)) * Update the copyright header for readthedocs ([testcontainers#341](testcontainers#341)) ([5bef18a](testcontainers@5bef18a)) --- 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> Co-authored-by: David Ankin <daveankin@gmail.com>
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.
we were using this code to test if it was online or not:
MongoClient(self.get_connection_url())
, but that doesn't actually perform any connection, instead you have to do something like:thanks to @smparekh for pointing this out, in his PR:
https://github.com/testcontainers/testcontainers-python/pull/80/files#diff-cf09f76f44db0af04c58ddb456ccae39f7e29ce1d9208acd5f514c0a7dccb646R78
this PR implements the workaround described in the PR: