Skip to content

Commit 81b8e56

Browse files
refactor(test-database): Database for tests
Now there is a database dedicated for tests.
1 parent 1aa6221 commit 81b8e56

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

docker/docker-compose.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3.9"
2-
31
services:
42
mysql:
53
build:
@@ -16,6 +14,22 @@ services:
1614
- "3307:3306"
1715
volumes:
1816
- mysql_data:/var/lib/mysql
17+
18+
mysql-test:
19+
build:
20+
context: ..
21+
dockerfile: docker/MySQL/dockerfile
22+
image: todolist-mysql
23+
container_name: todolist-mysql-test
24+
environment:
25+
MYSQL_ROOT_PASSWORD: root_pass
26+
MYSQL_DATABASE: todolist
27+
MYSQL_USER: app_test
28+
MYSQL_PASSWORD: app_pass_test
29+
ports:
30+
- "3308:3306"
31+
volumes:
32+
- mysql_data_test:/var/lib/mysql
1933

2034
api:
2135
build:
@@ -32,3 +46,4 @@ services:
3246

3347
volumes:
3448
mysql_data:
49+
mysql_data_test:

src/tests/utils/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from fastapi.testclient import TestClient
88

99

10-
SQLALCHEMY_DATABASE_URL = "mysql+pymysql://app:app_pass@localhost:3307/todolist"
10+
SQLALCHEMY_DATABASE_URL = "mysql+pymysql://app_test:app_pass_test@localhost:3308/todolist"
1111

1212
engine = create_engine(
1313
SQLALCHEMY_DATABASE_URL,

0 commit comments

Comments
 (0)