mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
test: add mariadb instances for test
This commit is contained in:
parent
c9e7a27441
commit
1dc106f053
@ -33,3 +33,58 @@ services:
|
||||
MYSQL_DATABASE: "sqlx"
|
||||
volumes:
|
||||
- "./sqlx-mysql/tests/sqlx.sql:/docker-entrypoint-initdb.d/sqlx.sql"
|
||||
|
||||
mariadb_10_6:
|
||||
image: mariadb:10.6
|
||||
ports:
|
||||
- 3320:3306
|
||||
environment:
|
||||
MYSQL_ROOT_HOST: "%"
|
||||
MYSQL_ROOT_PASSWORD: "password"
|
||||
MYSQL_DATABASE: "sqlx"
|
||||
volumes:
|
||||
- "./sqlx-mysql/tests/sqlx.sql:/docker-entrypoint-initdb.d/sqlx.sql"
|
||||
|
||||
mariadb_10_5:
|
||||
image: mariadb:10.5
|
||||
ports:
|
||||
- 3321:3306
|
||||
environment:
|
||||
MYSQL_ROOT_HOST: "%"
|
||||
MYSQL_ROOT_PASSWORD: "password"
|
||||
MYSQL_DATABASE: "sqlx"
|
||||
volumes:
|
||||
- "./sqlx-mysql/tests/sqlx.sql:/docker-entrypoint-initdb.d/sqlx.sql"
|
||||
|
||||
mariadb_10_4:
|
||||
image: mariadb:10.4
|
||||
ports:
|
||||
- 3322:3306
|
||||
environment:
|
||||
MYSQL_ROOT_HOST: "%"
|
||||
MYSQL_ROOT_PASSWORD: "password"
|
||||
MYSQL_DATABASE: "sqlx"
|
||||
volumes:
|
||||
- "./sqlx-mysql/tests/sqlx.sql:/docker-entrypoint-initdb.d/sqlx.sql"
|
||||
|
||||
mariadb_10_3:
|
||||
image: mariadb:10.3
|
||||
ports:
|
||||
- 3323:3306
|
||||
environment:
|
||||
MYSQL_ROOT_HOST: "%"
|
||||
MYSQL_ROOT_PASSWORD: "password"
|
||||
MYSQL_DATABASE: "sqlx"
|
||||
volumes:
|
||||
- "./sqlx-mysql/tests/sqlx.sql:/docker-entrypoint-initdb.d/sqlx.sql"
|
||||
|
||||
mariadb_10_2:
|
||||
image: mariadb:10.2
|
||||
ports:
|
||||
- 3324:3306
|
||||
environment:
|
||||
MYSQL_ROOT_HOST: "%"
|
||||
MYSQL_ROOT_PASSWORD: "password"
|
||||
MYSQL_DATABASE: "sqlx"
|
||||
volumes:
|
||||
- "./sqlx-mysql/tests/sqlx.sql:/docker-entrypoint-initdb.d/sqlx.sql"
|
||||
|
||||
6
x.py
6
x.py
@ -185,18 +185,18 @@ def run_database(db: str, *, force=False):
|
||||
if not force and not should_run(tag, default=False):
|
||||
return
|
||||
|
||||
out = subprocess.run([
|
||||
stderr = subprocess.run([
|
||||
"docker-compose",
|
||||
"up",
|
||||
"-d",
|
||||
db,
|
||||
], cwd=project_dir, check=True, capture_output=True).stdout
|
||||
], cwd=project_dir, check=True, capture_output=True).stderr
|
||||
|
||||
if db.startswith("mysql_") or db.startswith("mariadb_"):
|
||||
port = database_ports[db]
|
||||
url = f"mysql://root:password@localhost:{port}/sqlx"
|
||||
|
||||
if b"up-to-date" not in out:
|
||||
if b"up-to-date" not in stderr:
|
||||
# sleep 10 seconds the first time we start-up the db
|
||||
time.sleep(10)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user