|
8 | 8 | from testcontainers.mysql import MySqlContainer
|
9 | 9 |
|
10 | 10 |
|
11 |
| -@pytest.mark.skipif(is_arm(), reason="mysql container not available for ARM") |
12 | 11 | def test_docker_run_mysql():
|
13 |
| - config = MySqlContainer("mysql:5.7.17") |
| 12 | + config = MySqlContainer("mysql:8.3.0") |
14 | 13 | with config as mysql:
|
15 | 14 | engine = sqlalchemy.create_engine(mysql.get_connection_url())
|
16 | 15 | with engine.begin() as connection:
|
17 | 16 | result = connection.execute(sqlalchemy.text("select version()"))
|
18 | 17 | for row in result:
|
19 |
| - assert row[0].startswith("5.7.17") |
| 18 | + assert row[0].startswith("8.3.0") |
20 | 19 |
|
21 | 20 |
|
22 | 21 | @pytest.mark.skipif(is_arm(), reason="mysql container not available for ARM")
|
23 |
| -def test_docker_run_mysql_8(): |
24 |
| - config = MySqlContainer("mysql:8") |
| 22 | +def test_docker_run_legacy_mysql(): |
| 23 | + config = MySqlContainer("mysql:5.7.44") |
25 | 24 | with config as mysql:
|
26 | 25 | engine = sqlalchemy.create_engine(mysql.get_connection_url())
|
27 | 26 | with engine.begin() as connection:
|
28 | 27 | result = connection.execute(sqlalchemy.text("select version()"))
|
29 | 28 | for row in result:
|
30 |
| - assert row[0].startswith("8") |
| 29 | + assert row[0].startswith("5.7.44") |
31 | 30 |
|
32 | 31 |
|
33 |
| -def test_docker_run_mariadb(): |
34 |
| - with MySqlContainer("mariadb:10.6.5").maybe_emulate_amd64() as mariadb: |
| 32 | +@pytest.mark.parametrize("version", ["11.3.2", "10.11.7"]) |
| 33 | +def test_docker_run_mariadb(version: str): |
| 34 | + with MySqlContainer(f"mariadb:{version}") as mariadb: |
35 | 35 | engine = sqlalchemy.create_engine(mariadb.get_connection_url())
|
36 | 36 | with engine.begin() as connection:
|
37 | 37 | result = connection.execute(sqlalchemy.text("select version()"))
|
38 | 38 | for row in result:
|
39 |
| - assert row[0].startswith("10.6.5") |
| 39 | + assert row[0].startswith(version) |
40 | 40 |
|
41 | 41 |
|
42 | 42 | def test_docker_env_variables():
|
43 | 43 | with (
|
44 | 44 | mock.patch.dict("os.environ", MYSQL_USER="demo", MYSQL_DATABASE="custom_db"),
|
45 |
| - MySqlContainer("mariadb:10.6.5").with_bind_ports(3306, 32785).maybe_emulate_amd64() as container, |
| 45 | + MySqlContainer("mariadb:10.6.5").with_bind_ports(3306, 32785) as container, |
46 | 46 | ):
|
47 | 47 | url = container.get_connection_url()
|
48 | 48 | pattern = r"mysql\+pymysql:\/\/demo:test@[\w,.]+:(3306|32785)\/custom_db"
|
|
0 commit comments