-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
91 lines (87 loc) · 2.86 KB
/
docker-compose.yml
File metadata and controls
91 lines (87 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
services:
api:
image: datascientest/fastapi:1.0.0
ports:
- "8000:8000"
networks:
- sentiment_net
volumes:
# shared artifacts (test containers will write api_test.log here)
- ./shared:/shared
auth_test:
# Run as host user so /shared/api_test.log is created/appended with correct ownership
# (bind mount: ./shared -> /shared). Prevents root-owned log files (which could cause
# issues when resetting these files on test runs). Vars are exported by setup.sh.
user: "${HOST_UID}:${HOST_GID}"
build:
# IMPORTANT: context is repo root so we can `COPY tests /app/tests` (full package tree)
context: .
dockerfile: ./tests/authentication/Dockerfile
container_name: auth_test
depends_on:
api:
# Ensures sequential execution + deterministic log order.
# Run authentication tests only after api container started.
# ('API Readiness' is handled inside the tests via /status-polling as well)
condition: service_started
networks:
- sentiment_net
environment:
# Here we define the env vars for the test script execution
# (the path to the script is defined in the Dockerfile,
# which triggers the tests automatically)
#
# LOG=1 => append to shared log file (exam requirement)
- LOG=1
# These are optional overrides; defaults in the script are already correct
- API_ADDRESS=api
- API_PORT=8000
- LOG_PATH=/shared/api_test.log
- HTTP_TIMEOUT=5
volumes:
- ./shared:/shared
authz_test:
user: "${HOST_UID}:${HOST_GID}"
build:
context: .
dockerfile: ./tests/authorization/Dockerfile
container_name: authz_test
depends_on:
auth_test:
# Run authorization tests only after after authentication tests finished successfully.
# Ensures sequential execution + deterministic log order.
condition: service_completed_successfully
networks:
- sentiment_net
environment:
- LOG=1
- API_ADDRESS=api
- API_PORT=8000
- LOG_PATH=/shared/api_test.log
- HTTP_TIMEOUT=5
volumes:
- ./shared:/shared
content_test:
user: "${HOST_UID}:${HOST_GID}"
build:
context: .
dockerfile: ./tests/content/Dockerfile
container_name: cnt_test
depends_on:
authz_test:
# Run content tests only after after authorization tests finished successfully.
# Keeps pipeline (and logging) order: api -> auth -> authz -> content.
condition: service_completed_successfully
networks:
- sentiment_net
environment:
- LOG=1
- API_ADDRESS=api
- API_PORT=8000
- LOG_PATH=/shared/api_test.log
- HTTP_TIMEOUT=5
volumes:
- ./shared:/shared
networks:
sentiment_net:
driver: bridge