Skip to content

Commit 565a384

Browse files
committed
add test data base
1 parent f4c3b6c commit 565a384

5 files changed

Lines changed: 32 additions & 1 deletion

File tree

.env.sample

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,14 @@ GF_SECURITY_ADMIN_USER=admin
2222
GF_SECURITY_ADMIN_PASSWORD=admin
2323
# ==================CADDY==================
2424
ADMIN_USER=admin
25-
ADMIN_PASSWORD=admin
25+
ADMIN_PASSWORD=admin
26+
# ==================TESTS==================
27+
TEST_POSTGRES_DB=test_analizer
28+
TEST_POSTGRES_PASSWORD=
29+
30+
TEST_DB_ENGINE=postgresql+asyncpg
31+
TEST_DB_NAME=test_analizer
32+
TEST_DB_USER=postgres
33+
TEST_DB_PASSWORD=
34+
TEST_DB_HOST=test_db
35+
TEST_DB_PORT=5431

api_v1/tests/__init__.py

Whitespace-only changes.

api_v1/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import asyncio

config/config.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
config = Config('.env')
1212

1313

14+
class TestDBSettings(BaseModel):
15+
"""
16+
Настройки тестовой базы данных
17+
"""
18+
19+
20+
1421
class DBSettings(BaseModel):
1522
"""
1623
Настройки DataBase

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ services:
6868
env_file:
6969
- .env
7070

71+
test_db:
72+
restart: always
73+
image: postgres:16.3-alpine
74+
volumes:
75+
- test_postgres_data:/var/lib/postgresql/data/
76+
hostname: test_db
77+
expose:
78+
- 5431
79+
environment:
80+
- POSTGRES_DB=${TEST_POSTGRES_DB}
81+
- POSTGRES_PASSWORD=${TEST_POSTGRES_PASSWORD}
82+
7183
prometheus:
7284
image: prom/prometheus
7385
container_name: prometheus
@@ -143,6 +155,7 @@ services:
143155

144156
volumes:
145157
postgres_data:
158+
test_postgres_data:
146159
rabbitmq-data:
147160
prometheus-data: {}
148161
grafana-data: {}

0 commit comments

Comments
 (0)