Repository navigation
fix(core): prevent withStartupTimeout() from mutating shared DEFAULT_WAIT_STRATEGY #12204
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,4 +32,16 @@ public ConnectionFactoryOptions configure(ConnectionFactoryOptions options) { | |
| .option(ConnectionFactoryOptions.PASSWORD, container.getPassword()) | ||
| .build(); | ||
| } | ||
|
|
||
| @Override | ||
| public String getR2dbcUrl() { | ||
| String additionalParams = container.getUrlParameters(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Translate JDBC parameters before adding them to the R2DBC URL. With Translate supported options to their R2DBC representation, such as
|
||
| return "r2dbc:mariadb://" + | ||
| container.getHost() + | ||
| ":" + | ||
| container.getMappedPort(MariaDBContainer.MARIADB_PORT) + | ||
| "/" + | ||
| container.getDatabaseName() + | ||
| additionalParams; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,4 +32,16 @@ public ConnectionFactoryOptions configure(ConnectionFactoryOptions options) { | |
| .option(ConnectionFactoryOptions.PASSWORD, container.getPassword()) | ||
| .build(); | ||
| } | ||
|
|
||
| @Override | ||
| public String getR2dbcUrl() { | ||
| String additionalParams = container.getUrlParameters(); | ||
| return "r2dbc:postgresql://" + | ||
| container.getHost() + | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bracket raw IPv6 hosts in R2DBC URLs. If Bracket raw IPv6 hosts in all four accessors. Preserve hosts that already have brackets.
|
||
| ":" + | ||
| container.getMappedPort(PostgreSQLContainer.POSTGRESQL_PORT) + | ||
| "/" + | ||
| container.getDatabaseName() + | ||
| additionalParams; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,12 @@ | |
|
|
||
| public interface R2DBCDatabaseContainer extends Startable { | ||
| ConnectionFactoryOptions configure(ConnectionFactoryOptions options); | ||
|
|
||
| /** | ||
| * @return an R2DBC connection URL that may be used to connect to the dockerized database | ||
| * @throws UnsupportedOperationException if the container does not implement this method | ||
| */ | ||
| default String getR2dbcUrl() { | ||
| throw new UnsupportedOperationException("getR2dbcUrl not implemented for this container"); | ||
|
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implement the accessor in the module-package adapters. The Add the corresponding overrides to the module-package adapters. Keep this default for external implementations that do not support URL access.
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the default strategies in this regression test.
Each
waitingFor(...)call replaces the strategy configured bywithStartupTimeout(...). The assertions therefore compare two newly allocatedWaitForExitedStateobjects. All three assertions also pass with the original shared-timeout bug.Remove these overrides and the unused startup configuration. Check the default strategy identities and their configured timeouts. Also check that an untouched container retains its original timeout. No container startup is needed. Use try-with-resources for the container declarations.
As per path instructions, “A bug fix or behaviour change needs a test that fails without it” and tests require “try-with-resources around containers.”
Also applies to: 429-429
Source: Path instructions