Skip to content

Commit 9be645d

Browse files
committed
Fix Express CI tests: add directConnection=true to MongoDB URI
The Atlas CLI local deployment creates a replica set (myLocalRs1) that advertises hostname 'mylocalrs1'. Without directConnection=true, the MongoDB driver attempts server discovery and fails to resolve this hostname in CI, causing all tests to fail with: MongoServerSelectionError: getaddrinfo EAI_AGAIN mylocalrs1
1 parent 556d9e5 commit 9be645d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/run-express-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ jobs:
5454
working-directory: mflix/server/js-express
5555
run: npm run test:unit -- --json --outputFile=test-results-unit.json || true
5656
env:
57-
MONGODB_URI: mongodb://localhost:27017/sample_mflix
57+
MONGODB_URI: mongodb://localhost:27017/sample_mflix?directConnection=true
5858

5959
- name: Run integration tests
6060
working-directory: mflix/server/js-express
6161
run: npm run test:integration -- --json --outputFile=test-results-integration.json || true
6262
env:
63-
MONGODB_URI: mongodb://localhost:27017/sample_mflix
63+
MONGODB_URI: mongodb://localhost:27017/sample_mflix?directConnection=true
6464
ENABLE_SEARCH_TESTS: true
6565
# Note: Vector search tests will be skipped without VOYAGE_API_KEY
6666
# Run these tests locally with a valid API key

0 commit comments

Comments
 (0)