-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
124 lines (115 loc) · 4.58 KB
/
docker-compose.test.yml
File metadata and controls
124 lines (115 loc) · 4.58 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Giulia Test Environment — Isolated, Clean, Reproducible
#
# Separate from the dev/prod compose. Starts its own ArcadeDB,
# uses fresh volumes, runs with MIX_ENV=test, and exits with
# the test exit code.
#
# Usage:
# docker compose -f docker-compose.test.yml run --rm giulia-test
# docker compose -f docker-compose.test.yml run --rm giulia-test test/giulia/foo/bar_test.exs
# docker compose -f docker-compose.test.yml run --rm giulia-test test/giulia/foo/bar_test.exs:42
# docker compose -f docker-compose.test.yml run --rm giulia-test --trace
# docker compose -f docker-compose.test.yml run --rm giulia-test --failed
# docker compose -f docker-compose.test.yml down -v # Clean up volumes
#
# The test runner uses /projects/Giulia (live mount), NOT /app (stale image copy).
# NEVER run `mix format` inside this container — see TESTING.md for why.
#
# HERMETIC BY CONSTRUCTION: this stack uses its own project name (`giulia-test`),
# its own network, and `giulia_test_*` / `arcadedb_test_*` volumes only. It is
# mechanically incapable of touching prod state (`giulia_data`, `giulia_build`,
# `giulia_deps`, `giulia_models`, `giulia-worker`, `giulia-monitor`).
# `down -v` is unconditionally safe.
name: giulia-test
services:
# ============================================================================
# ArcadeDB — dedicated test instance, fresh database, no host port conflicts
# ============================================================================
arcadedb-test:
image: arcadedata/arcadedb:latest
container_name: giulia-arcadedb-test
hostname: arcadedb
volumes:
- arcadedb_test_data:/home/arcadedb/databases
environment:
JAVA_OPTS: >-
-Darcadedb.server.rootPassword=playwithdata
-Xmx256m
deploy:
resources:
limits:
memory: 512M
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:2480/api/v1/ready || exit 1"]
interval: 5s
timeout: 5s
start_period: 15s
retries: 5
# ============================================================================
# Test Runner — runs mix test and exits
#
# Any arguments passed via `docker compose run` are forwarded to `mix test`.
# Examples:
# (no args) → mix test
# test/giulia/foo_test.exs → mix test test/giulia/foo_test.exs
# test/giulia/foo_test.exs:42 → mix test test/giulia/foo_test.exs:42
# --trace → mix test --trace
# --failed → mix test --failed
# ============================================================================
giulia-test:
image: giulia/core:latest
build:
context: .
dockerfile: Dockerfile
container_name: giulia-test
hostname: giulia-test
depends_on:
arcadedb-test:
condition: service_healthy
# scripts/test-entrypoint.sh: cd /projects/Giulia && mix deps.get && exec mix test "$@"
entrypoint: ["/bin/sh", "/projects/Giulia/scripts/test-entrypoint.sh"]
command: []
environment:
MIX_ENV: test
MIX_BUILD_PATH: /tmp/giulia_test_build
MIX_DEPS_PATH: /tmp/giulia_deps
XLA_TARGET: cpu
GIULIA_IN_CONTAINER: "true"
GIULIA_HOME: /data
GIULIA_DAEMON_MODE: "true"
GIULIA_HOST_PROJECTS_PATH: ${GIULIA_HOST_PROJECTS_PATH:-D:/Development/GitHub}
# ArcadeDB points to the test-dedicated instance
ARCADEDB_URL: http://arcadedb:2480
ARCADEDB_DB: giulia
ARCADEDB_USER: root
ARCADEDB_PASSWORD: playwithdata
volumes:
# Live source mount — edits on host are immediately visible
- ${GIULIA_PROJECTS_PATH:-D:/Development/GitHub}:/projects:rw
# Test-isolated deps cache — separate from prod's giulia_deps so
# `down -v` cannot wipe prod's Mix dependency cache.
- giulia_test_deps:/tmp/giulia_deps
# Isolated test build (separate from dev to avoid MIX_ENV collisions)
- giulia_test_build:/tmp/giulia_test_build
# Test-isolated model cache — separate from prod's giulia_models so
# `down -v` cannot wipe prod's Bumblebee/EXLA embedding model cache.
- giulia_test_models:/root/.cache
# Temp data dir (CubDB etc — fresh each run via tmpfs)
- giulia_test_data:/data
deploy:
resources:
limits:
memory: 8G
reservations:
memory: 1G
volumes:
giulia_test_deps:
name: giulia_test_deps
giulia_test_build:
name: giulia_test_build
giulia_test_models:
name: giulia_test_models
arcadedb_test_data:
# Fresh each `down -v`
giulia_test_data:
# Fresh each `down -v`