Skip to content

Commit e0355ec

Browse files
committed
fix(test): dial the Mongo port the skip-gate actually probes
test_legacy_backups asked conftest's ``mongo_service`` gate about 27018 and then connected to 27017, so the module only ran where both ports had a server. CI publishes 27018 only: the gate passed, the connection was refused, and two tests errored. Every other Mongo test already defaults to 27018. Masked until now because collection aborted earlier in the run.
1 parent f8b3b98 commit e0355ec

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

backends/advanced/tests/test_legacy_backups.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242
async def init_db():
4343
"""Beanie refuses to *construct* a Document before initialization, so the two
4444
mapping tests need a database even though they never write to one."""
45-
client = AsyncIOMotorClient(os.getenv("MONGODB_URI", "mongodb://localhost:27017"))
45+
# 27018, matching conftest's ``mongo_service`` gate and every other Mongo test.
46+
# Dialling 27017 while the gate probes 27018 means the module only runs where
47+
# both ports have a server: CI publishes 27018 only, so it skipped the gate and
48+
# then failed to connect.
49+
client = AsyncIOMotorClient(os.getenv("MONGODB_URI", "mongodb://localhost:27018"))
4650
name = os.getenv("TEST_DB_NAME", "test_legacy_backups")
4751
await init_beanie(database=client[name], document_models=[Conversation])
4852
yield

0 commit comments

Comments
 (0)