feat: add mariadb module#1548
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
Note that the sonarcloud warning is related to the existing duplication in the mariadb, which is basically shadowing what the mysql does. There subtle differences (see above), but the module is in practice the same. |
|
I tested with 10.5.5 locally and te MARIADB_ prefix was not accepted (container failed to start because of no credentials were passed by the module container, which passed MARIADB-only variables. Do you think we should support that version, or on the contrary keep the lower limit in the 11.0.3? |
* main: modulegen: generate md file inside internal/mkdocs (testcontainers#1543) modulegen: create internal/module and internal/modfile (testcontainers#1539)
According to the docs,
11.0.3 is fairly new. In this case, I think it is ok to support previous images with |
| // It will look up for MARIADB environment variables. | ||
| func WithDefaultCredentials() testcontainers.CustomizeRequestOption { | ||
| return func(req *testcontainers.GenericContainerRequest) { | ||
| username := req.Env["MARIADB_USER"] |
There was a problem hiding this comment.
@eddumelendez would you see it convenient to check for MYSQL_ variables here? I could imagine evaluating the vars in this order:
- check for MYSQL
- check for MARIADB (more precedence)
There was a problem hiding this comment.
interesting! However, I would rather use withUsername, withPassword and withDatabase rather than using the env vars directly. I don't think this is an issue because this is a new module, it would be if it is an existing one and just new utility fn were added but that's not the case. Those moving from GenericContainer to the module will also take that into account, I think. Historically, we haven't received issues about it in tc java. Of course, there is an assumption about using the module but if we suggest to use the module because of the pre configuration it brings then it is ok.
If we are going to plan to support MARIADB_ env vars because MYSQL_ can be deprecated then I would respect the default image's precedence.
|
SonarCloud Quality Gate failed.
|
* main: (32 commits) fix: remove wrong example from workspace (testcontainers#1556) chore(deps): bump the all group in /modules/localstack with 1 update (testcontainers#1552) modulegen: generate code-workspace with json marshal (testcontainers#1551) chore(deps): bump the all group in /modules/compose with 2 updates (testcontainers#1553) feat: add mariadb module (testcontainers#1548) feat(modulegen): print out VSCode workspace file if needed (testcontainers#1549) modulegen: generate md file inside internal/mkdocs (testcontainers#1543) modulegen: create internal/module and internal/modfile (testcontainers#1539) [Enhancement]: add ability to set repo:tag for ContainerRequest FromDockerfile (testcontainers#1508) Fix module generator for examples (testcontainers#1545) Update pulsar.md (testcontainers#1542) modulegen: create internal/make (testcontainers#1537) chore: fix workflow (testcontainers#1538) chore(deps): bump the all group in /examples/cockroachdb with 1 update (testcontainers#1522) chore(deps): bump the all group in /examples/bigtable with 1 update (testcontainers#1534) chore(deps): bump the all group in /modules/localstack with 4 updates (testcontainers#1535) chore(deps): bump the all group in /modules/k3s with 2 updates (testcontainers#1526) chore(deps): bump the all group in /examples/spanner with 2 updates (testcontainers#1532) chore(deps): bump the all group in /examples/firestore with 1 update (testcontainers#1523) chore(deps): bump the all group in /modules/redis with 1 update (testcontainers#1524) ...










What does this PR do?
It uses the module generator to bootstrap the code for the MariaDB module, and also copies the MySQL one to implement the features we need for MariaDB.
The only differences I noticed:
my.cnffile, I had to increase thethread_stackfrom 128K to 256K, otherwise an error was thrown by the container startup.tls=falseis used in the tests.mariadb:10.5.5base image, but it does not accept theMARIADB_prefix environment variables, as expected. That image wantsMYSQL_variables. For that reason, I moved tomariadb:11.0.3instead, which uses theMARIADB_prefix. Therefore, this module will copy allMARIADB_variables to theMYSQL_variables. @eddumelendez is this considered in the Java impl?Why is it important?
Add a new module!