fix: url quote passwords#549
Merged
alexanderankin merged 7 commits intotestcontainers:mainfrom Apr 20, 2024
Merged
Conversation
Member
|
looks good, running these tests on my machine first and fixing some stuff up with static ports had this other thought: do we care to simulate the craziest input possible, or is it better to replicate exactly the situation you saw, which is the auth denied error? not sure, maybe you have considered this though e.g. diff --git a/modules/mysql/tests/test_mysql.py b/modules/mysql/tests/test_mysql.py
index 62deac5..8ab347f 100644
--- a/modules/mysql/tests/test_mysql.py
+++ b/modules/mysql/tests/test_mysql.py
@@ -58,11 +58,21 @@ def test_docker_env_variables():
# - mongodb
def test_quoted_password():
user = "root"
- password = "p@$%25+0&%rd :/!=?"
- quoted_password = "p%40%24%2525+0%26%25rd %3A%2F%21%3D%3F"
+ password = "p$%25+0&%rd"
+ quoted_password = "p%24%2525+0%26%25rd"
driver = "pymysql"maybe the answer is to parametrize, or i am just overthinking it |
Member
|
opened #550 because debugging mssql is very not fun on a mac at the moment. |
Member
|
alright hopefully this doesn't break anybody |
alexanderankin
pushed a commit
that referenced
this pull request
May 14, 2024
🤖 I have created a release *beep* *boop* --- ## [4.4.1](testcontainers-v4.4.0...testcontainers-v4.4.1) (2024-05-14) ### Bug Fixes * Add memcached container ([#322](#322)) ([690b9b4](690b9b4)) * Add selenium video support [#6](#6) ([#364](#364)) ([3c8006c](3c8006c)) * **core:** add empty _configure to DockerContainer ([#556](#556)) ([08916c8](08916c8)) * **core:** remove version from compose tests ([#571](#571)) ([38946d4](38946d4)) * **keycloak:** add realm imports ([#565](#565)) ([f761b98](f761b98)) * **mysql:** Add seed support in MySQL ([#552](#552)) ([396079a](396079a)) * url quote passwords ([#549](#549)) ([6c5d227](6c5d227)) --- 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>
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.
Changes
Updated DbContainer to fix #547 by using
urllib.parse.quote. I referenced sqlalchemy's implementation, but have not imported the library.I have chosen to make this behaviour occur at all times (can't opt in / out), as it is common, if not the standard for these urls.
Tests
Since DbContainer can't be tested on its own, I put the tests across various database containers. I have pasted the below as comment in the test files for the listed modules:
Note the discussion recommended me to test with oracle, but I was unable to spin the container up locally (even with colima), so opted to replace it with mongodb.
Is there a template for PRs for the core library? I am unable to find one so have opted the above format. Please let me know if I have missed anything in this PR. Thanks!