Skip to content

Commit cefaf55

Browse files
patbaumgartnerdsyer
authored andcommitted
Downgrading to mysql 9.2
- MySQL 9.3 does not work with testcontainers 1.21.0. Database container terminates with errors Signed-off-by: Patrick Baumgartner <contact@patbaumgartner.com>
1 parent 2e61f19 commit cefaf55

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ A similar setup is provided for MySQL and PostgreSQL if a persistent database co
5454
You can start MySQL or PostgreSQL locally with whatever installer works for your OS or use docker:
5555

5656
```bash
57-
docker run -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:9.3
57+
docker run -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:9.2
5858
```
5959

6060
or

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
mysql:
3-
image: mysql:9.3
3+
image: mysql:9.2
44
ports:
55
- "3306:3306"
66
environment:

src/test/java/org/springframework/samples/petclinic/MySqlIntegrationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.testcontainers.containers.MySQLContainer;
3737
import org.testcontainers.junit.jupiter.Container;
3838
import org.testcontainers.junit.jupiter.Testcontainers;
39+
import org.testcontainers.utility.DockerImageName;
3940

4041
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
4142
@ActiveProfiles("mysql")
@@ -46,7 +47,7 @@ class MySqlIntegrationTests {
4647

4748
@ServiceConnection
4849
@Container
49-
static MySQLContainer<?> container = new MySQLContainer<>("mysql:9.3");
50+
static MySQLContainer<?> container = new MySQLContainer<>(DockerImageName.parse("mysql:9.2"));
5051

5152
@LocalServerPort
5253
int port;

src/test/java/org/springframework/samples/petclinic/MysqlTestApplication.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.context.annotation.Configuration;
2323
import org.springframework.context.annotation.Profile;
2424
import org.testcontainers.containers.MySQLContainer;
25+
import org.testcontainers.utility.DockerImageName;
2526

2627
/**
2728
* PetClinic Spring Boot Application.
@@ -35,7 +36,7 @@ public class MysqlTestApplication {
3536
@Profile("mysql")
3637
@Bean
3738
static MySQLContainer<?> container() {
38-
return new MySQLContainer<>("mysql:9.3");
39+
return new MySQLContainer<>(DockerImageName.parse("mysql:9.2"));
3940
}
4041

4142
public static void main(String[] args) {

0 commit comments

Comments
 (0)