Skip to content

Commit d836280

Browse files
committed
Merge branch 'main' into worktree-teams-foundation
2 parents 2564128 + 68ffe67 commit d836280

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

docker-compose.e2e.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ services:
77
image: mongo:7.0.2
88
hostname: mongo
99
restart: "no"
10-
volumes:
11-
- ./rs-initiate.js:/docker-entrypoint-initdb.d/rs-initiate.js
1210
tmpfs:
1311
- /data/db
1412
- /data/configdb
@@ -20,6 +18,16 @@ services:
2018
# only host-side e2e helpers use it (see e2e/helpers/constants.ts MONGO_URI).
2119
- "${E2E_MONGO_PORT:-27019}:27017"
2220
command: ["--replSet", "dbrs", "--bind_ip_all", "--port", "27017"]
21+
# The replica set is initiated via the healthcheck rather than a
22+
# docker-entrypoint-initdb.d script: init scripts make the mongo image start a
23+
# temporary mongod, then stop it and start the real one, and the second start
24+
# can race the first for port 27017 ("Address already in use", exit code 48),
25+
# killing the container and the whole E2E stack with it.
26+
healthcheck:
27+
test: ["CMD", "mongosh", "--quiet", "--eval", "try { quit(rs.status().myState === 1 ? 0 : 1) } catch (e) { rs.initiate(); quit(1) }"]
28+
interval: 2s
29+
timeout: 10s
30+
retries: 30
2331
networks:
2432
- e2e-default
2533

@@ -251,7 +259,7 @@ services:
251259
- "host.docker.internal:host-gateway"
252260
depends_on:
253261
mongo:
254-
condition: service_started
262+
condition: service_healthy
255263
rabbitmq-broker:
256264
condition: service_healthy
257265
healthcheck:

0 commit comments

Comments
 (0)