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>
This commit is contained in:
committed by
Dave Syer
parent
2e61f19c66
commit
cefaf55dd1
@@ -54,7 +54,7 @@ A similar setup is provided for MySQL and PostgreSQL if a persistent database co
|
||||
You can start MySQL or PostgreSQL locally with whatever installer works for your OS or use docker:
|
||||
|
||||
```bash
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:9.3
|
||||
image: mysql:9.2
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
import org.testcontainers.containers.MySQLContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
@ActiveProfiles("mysql")
|
||||
@@ -46,7 +47,7 @@ class MySqlIntegrationTests {
|
||||
|
||||
@ServiceConnection
|
||||
@Container
|
||||
static MySQLContainer<?> container = new MySQLContainer<>("mysql:9.3");
|
||||
static MySQLContainer<?> container = new MySQLContainer<>(DockerImageName.parse("mysql:9.2"));
|
||||
|
||||
@LocalServerPort
|
||||
int port;
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.testcontainers.containers.MySQLContainer;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
|
||||
/**
|
||||
* PetClinic Spring Boot Application.
|
||||
@@ -35,7 +36,7 @@ public class MysqlTestApplication {
|
||||
@Profile("mysql")
|
||||
@Bean
|
||||
static MySQLContainer<?> container() {
|
||||
return new MySQLContainer<>("mysql:9.3");
|
||||
return new MySQLContainer<>(DockerImageName.parse("mysql:9.2"));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Reference in New Issue
Block a user