Skip to content

Commit 3aa5fbf

Browse files
rnorthbsideup
andauthored
Use up-to-date MySQL docker images (#4059)
Co-authored-by: Sergei Egorov <[email protected]>
1 parent f94737f commit 3aa5fbf

File tree

22 files changed

+70
-70
lines changed

22 files changed

+70
-70
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
redis:
22
image: redis
33
db:
4-
image: mysql:5.7.22
4+
image: mysql:5.7.34
55
environment:
66
MYSQL_RANDOM_ROOT_PASSWORD: "true"

docs/examples/junit4/generic/src/test/java/generic/ImageNameSubstitutionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public class ImageNameSubstitutionTest {
1212
public void simpleExample() {
1313
try (
1414
// directDockerHubReference {
15-
// Referring directly to an image on Docker Hub (mysql:8.0.22)
15+
// Referring directly to an image on Docker Hub (mysql:8.0.24)
1616
final MySQLContainer<?> mysql = new MySQLContainer<>(
17-
DockerImageName.parse("mysql:8.0.22")
17+
DockerImageName.parse("mysql:8.0.24")
1818
)
1919

2020
// start the container and use it for testing
@@ -35,7 +35,7 @@ public void substitutedExample() {
3535
// hardcodedMirror {
3636
// Referring directly to an image on a private registry - image name will vary
3737
final MySQLContainer<?> mysql = new MySQLContainer<>(
38-
DockerImageName.parse("registry.mycompany.com/mirror/mysql:8.0.22")
38+
DockerImageName.parse("registry.mycompany.com/mirror/mysql:8.0.24")
3939
.asCompatibleSubstituteFor("mysql")
4040
)
4141

docs/examples/junit4/generic/src/test/java/generic/support/TestSpecificImageNameSubstitutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class TestSpecificImageNameSubstitutor extends ImageNameSubstitutor {
1212

1313
@Override
1414
public DockerImageName apply(final DockerImageName original) {
15-
if (original.equals(DockerImageName.parse("registry.mycompany.com/mirror/mysql:8.0.22"))) {
15+
if (original.equals(DockerImageName.parse("registry.mycompany.com/mirror/mysql:8.0.24"))) {
1616
return DockerImageName.parse("mysql");
1717
} else {
1818
return original;

docs/features/image_name_substitution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Consider this if:
5353

5454
* Developers and CI machines need to use different image names. For example, developers are able to pull images from Docker Hub, but CI machines need to pull from a private registry
5555
* Your private registry has copies of images from Docker Hub where the names are predictable, and just adding a prefix is enough.
56-
For example, `registry.mycompany.com/mirror/mysql:8.0.22` can be derived from the original Docker Hub image name (`mysql:8.0.22`) with a consistent prefix string: `registry.mycompany.com/mirror/`
56+
For example, `registry.mycompany.com/mirror/mysql:8.0.24` can be derived from the original Docker Hub image name (`mysql:8.0.24`) with a consistent prefix string: `registry.mycompany.com/mirror/`
5757

5858
In this case, image name references in code are **unchanged**.
5959
i.e. you would leave as-is:

docs/modules/databases/jdbc.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Insert `tc:` after `jdbc:` as follows. Note that the hostname, port and database
2020

2121
!!! note
2222
We will use `///` (host-less URIs) from now on to emphasis the unimportance of the `host:port` pair.
23-
From Testcontainers' perspective, `jdbc:mysql:5.7.22://localhost:3306/databasename` and `jdbc:mysql:5.7.22:///databasename` is the same URI.
23+
From Testcontainers' perspective, `jdbc:mysql:5.7.34://localhost:3306/databasename` and `jdbc:mysql:5.7.34:///databasename` is the same URI.
2424

2525
!!! warning
2626
If you're using the JDBC URL support, there is no need to instantiate an instance of the container - Testcontainers will do it automagically.
@@ -29,7 +29,7 @@ Insert `tc:` after `jdbc:` as follows. Note that the hostname, port and database
2929

3030
#### Using Testcontainers with a fixed version
3131

32-
`jdbc:tc:mysql:5.6.23:///databasename`
32+
`jdbc:tc:mysql:5.7.34:///databasename`
3333

3434
#### Using PostgreSQL
3535

@@ -47,21 +47,21 @@ Insert `tc:` after `jdbc:` as follows. Note that the hostname, port and database
4747

4848
Testcontainers can run an init script after the database container is started, but before your code is given a connection to it. The script must be on the classpath, and is referenced as follows:
4949

50-
`jdbc:tc:mysql:5.7.22:///databasename?TC_INITSCRIPT=somepath/init_mysql.sql`
50+
`jdbc:tc:mysql:5.7.34:///databasename?TC_INITSCRIPT=somepath/init_mysql.sql`
5151

5252
This is useful if you have a fixed script for setting up database schema, etc.
5353

5454
### Using an init script from a file
5555

5656
If the init script path is prefixed `file:`, it will be loaded from a file (relative to the working directory, which will usually be the project root).
5757

58-
`jdbc:tc:mysql:5.7.22:///databasename?TC_INITSCRIPT=file:src/main/resources/init_mysql.sql`
58+
`jdbc:tc:mysql:5.7.34:///databasename?TC_INITSCRIPT=file:src/main/resources/init_mysql.sql`
5959

6060
### Using an init function
6161

6262
Instead of running a fixed script for DB setup, it may be useful to call a Java function that you define. This is intended to allow you to trigger database schema migration tools. To do this, add TC_INITFUNCTION to the URL as follows, passing a full path to the class name and method:
6363

64-
`jdbc:tc:mysql:5.7.22:///databasename?TC_INITFUNCTION=org.testcontainers.jdbc.JDBCDriverTest::sampleInitFunction`
64+
`jdbc:tc:mysql:5.7.34:///databasename?TC_INITFUNCTION=org.testcontainers.jdbc.JDBCDriverTest::sampleInitFunction`
6565

6666
The init function must be a public static method which takes a `java.sql.Connection` as its only parameter, e.g.
6767
```java
@@ -76,7 +76,7 @@ public class JDBCDriverTest {
7676

7777
By default database container is being stopped as soon as last connection is closed. There are cases when you might need to start container and keep it running till you stop it explicitly or JVM is shutdown. To do this, add `TC_DAEMON` parameter to the URL as follows:
7878

79-
`jdbc:tc:mysql:5.7.22:///databasename?TC_DAEMON=true`
79+
`jdbc:tc:mysql:5.7.34:///databasename?TC_DAEMON=true`
8080

8181
With this parameter database container will keep running even when there're no open connections.
8282

docs/modules/databases/mysql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ See [Database containers](./index.md) for documentation and usage that is common
77
For MySQL databases, it is possible to override configuration settings using resources on the classpath. Assuming `somepath/mysql_conf_override`
88
is a directory on the classpath containing .cnf files, the following URL can be used:
99

10-
`jdbc:tc:mysql:5.6://hostname/databasename?TC_MY_CNF=somepath/mysql_conf_override`
10+
`jdbc:tc:mysql:5.7.34://hostname/databasename?TC_MY_CNF=somepath/mysql_conf_override`
1111

1212
Any .cnf files in this classpath directory will be mapped into the database container's /etc/mysql/conf.d directory,
1313
and will be able to override server settings when the container starts.

docs/modules/databases/r2dbc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The started container will be terminated when the `ConnectionFactory` is closed.
2222
**Note that, unlike Testcontainers' JDBC URL support, it is not possible to specify an image tag in the 'scheme' part of the URL, and it is always necessary to specify a tag using `TC_IMAGE_TAG`.**
2323

2424
So that the URL becomes:
25-
`r2dbc:tc:mysql:///databasename?TC_IMAGE_TAG=5.7.22`
25+
`r2dbc:tc:mysql:///databasename?TC_IMAGE_TAG=5.7.34`
2626

2727
!!! note
2828
We will use `///` (host-less URIs) from now on to emphasis the unimportance of the `host:port` pair.
@@ -35,7 +35,7 @@ So that the URL becomes:
3535

3636
#### Using MySQL
3737

38-
`r2dbc:tc:mysql:///databasename?TC_IMAGE_TAG=5.6.23`
38+
`r2dbc:tc:mysql:///databasename?TC_IMAGE_TAG=5.7.34`
3939

4040
#### Using MariaDB
4141

modules/jdbc-test/src/main/java/org/testcontainers/db/AbstractContainerDatabaseTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ protected DataSource getDataSource(JdbcDatabaseContainer<?> container) {
2727
hikariConfig.setUsername(container.getUsername());
2828
hikariConfig.setPassword(container.getPassword());
2929
hikariConfig.setDriverClassName(container.getDriverClassName());
30-
3130
return new HikariDataSource(hikariConfig);
3231
}
3332
}

modules/jdbc/src/test/java/org/testcontainers/jdbc/ConnectionUrlDriversTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class ConnectionUrlDriversTests {
3333
public static Iterable<Object[]> data() {
3434
return asList(
3535
new Object[][]{
36-
{"jdbc:tc:mysql:5.5.43://hostname/test", "mysql", Optional.of("5.5.43"), "hostname/test", "test"},
36+
{"jdbc:tc:mysql:5.7.34://hostname/test", "mysql", Optional.of("5.7.34"), "hostname/test", "test"},
3737
{"jdbc:tc:mysql://hostname/test", "mysql", Optional.empty(), "hostname/test", "test"},
3838
{"jdbc:tc:postgresql:1.2.3://hostname/test", "postgresql", Optional.of("1.2.3"), "hostname/test", "test"},
3939
{"jdbc:tc:postgresql://hostname/test", "postgresql", Optional.empty(), "hostname/test", "test"},

modules/jdbc/src/test/java/org/testcontainers/jdbc/ConnectionUrlTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public class ConnectionUrlTest {
1616

1717
@Test
1818
public void testConnectionUrl1() {
19-
String urlString = "jdbc:tc:mysql:5.6.23://somehostname:3306/databasename?a=b&c=d";
19+
String urlString = "jdbc:tc:mysql:5.7.34://somehostname:3306/databasename?a=b&c=d";
2020
ConnectionUrl url = ConnectionUrl.newInstance(urlString);
2121

2222
assertEquals("Database Type value is as expected", "mysql", url.getDatabaseType());
23-
assertEquals("Database Image tag value is as expected", "5.6.23", url.getImageTag().get());
23+
assertEquals("Database Image tag value is as expected", "5.7.34", url.getImageTag().get());
2424
assertEquals("Database Host String is as expected", "somehostname:3306/databasename", url.getDbHostString());
2525
assertEquals("Query String value is as expected", "?a=b&c=d", url.getQueryString().get());
2626
assertEquals("Database Host value is as expected", "somehostname", url.getDatabaseHost().get());
@@ -72,7 +72,7 @@ public void testTmpfsOption() {
7272

7373
@Test
7474
public void testInitScriptPathCapture() {
75-
String urlString = "jdbc:tc:mysql:5.6.23://somehostname:3306/databasename?a=b&c=d&TC_INITSCRIPT=somepath/init_mysql.sql";
75+
String urlString = "jdbc:tc:mysql:5.7.34://somehostname:3306/databasename?a=b&c=d&TC_INITSCRIPT=somepath/init_mysql.sql";
7676
ConnectionUrl url = ConnectionUrl.newInstance(urlString);
7777

7878
assertEquals("Database Type value is as expected", "somepath/init_mysql.sql", url.getInitScriptPath().get());
@@ -88,7 +88,7 @@ public void testInitScriptPathCapture() {
8888

8989
@Test
9090
public void testInitFunctionCapture() {
91-
String urlString = "jdbc:tc:mysql:5.6.23://somehostname:3306/databasename?a=b&c=d&TC_INITFUNCTION=org.testcontainers.jdbc.JDBCDriverTest::sampleInitFunction";
91+
String urlString = "jdbc:tc:mysql:5.7.34://somehostname:3306/databasename?a=b&c=d&TC_INITFUNCTION=org.testcontainers.jdbc.JDBCDriverTest::sampleInitFunction";
9292
ConnectionUrl url = ConnectionUrl.newInstance(urlString);
9393

9494
assertTrue("Init Function parameter exists", url.getInitFunction().isPresent());
@@ -100,7 +100,7 @@ public void testInitFunctionCapture() {
100100

101101
@Test
102102
public void testDaemonCapture() {
103-
String urlString = "jdbc:tc:mysql:5.6.23://somehostname:3306/databasename?a=b&c=d&TC_DAEMON=true";
103+
String urlString = "jdbc:tc:mysql:5.7.34://somehostname:3306/databasename?a=b&c=d&TC_DAEMON=true";
104104
ConnectionUrl url = ConnectionUrl.newInstance(urlString);
105105

106106
assertTrue("Daemon flag is set to true.", url.isInDaemonMode());

0 commit comments

Comments
 (0)