fix: wait for connection string when creating a deployment#1291
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Atlas Local deployment readiness by ensuring atlas-local-create-deployment (and now atlas-local-connect-deployment) waits until a usable connection string is available, avoiding failures caused by Docker port bindings not being published yet. It also standardizes ad-hoc test sleeps/timeouts onto a shared sleep() helper.
Changes:
- Add
waitForConnectionString()helper with retry logic for “Missing port binding information”, and use it in Atlas Local create/connect tools. - Introduce
sleep(ms)insrc/common/managedTimeout.tsand replace scattered testsetTimeout/timeouthelpers with it. - Add unit coverage for the connection string retry behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/common/exportsManager.test.ts | Replace helper timeout() usage with shared sleep() to keep tests consistent. |
| tests/unit/common/atlasLocal/connectionString.test.ts | New unit tests for waitForConnectionString() retry/throw behavior. |
| tests/integration/transports/streamableHttp.test.ts | Replace timeout() usage with shared sleep(). |
| tests/integration/transports/createSessionConfig.test.ts | Replace ad-hoc setTimeout sleeps with shared sleep(). |
| tests/integration/tools/mongodb/mongodbHelpers.ts | Replace timeout() retry delay with shared sleep(). |
| tests/integration/tools/mongodb/mongodbClusterProcess.ts | Replace ad-hoc retry delay with shared sleep(). |
| tests/integration/tools/atlas/clusters.test.ts | Switch to shared sleep() import (removes reliance on test helper sleep). |
| tests/integration/tools/atlas/atlasHelpers.ts | Remove local sleep() helper in favor of shared sleep(). |
| tests/integration/resources/exportedData.test.ts | Replace timeout() polling delay with shared sleep(). |
| tests/integration/helpers.ts | Remove exported timeout()/sleep() helpers (callers updated to use shared sleep()). |
| tests/integration/common/connectionManager.oidc.test.ts | Replace timeout() usage with shared sleep(). |
| tests/eval/lib/seeding.ts | Replace ad-hoc setTimeout delay with shared sleep(). |
| src/tools/atlasLocal/create/createDeployment.ts | Wait for connection string availability after creating a deployment. |
| src/tools/atlasLocal/connect/connectDeployment.ts | Use waitForConnectionString() instead of calling getConnectionString() directly. |
| src/tools/atlas/connect/connectCluster.ts | Replace local sleep() helper with shared sleep() import. |
| src/common/managedTimeout.ts | Add shared sleep(ms) helper. |
| src/common/atlasLocal/connectionString.ts | New retry helper that waits for port binding publication via connection string polling. |
| scripts/cleanupAtlasTestLeftovers.test.ts | Replace local sleep() helper with shared sleep() import. |
gagik
approved these changes
Jun 29, 2026
maastha
pushed a commit
that referenced
this pull request
Jun 30, 2026
dudaschar
pushed a commit
that referenced
this pull request
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
atlas-local-create-deploymentwould return as soon as the healthcheck returns healthy, even if the sample dataset isn't loaded yet. This caused connect-deployment to fail with a "missing binding port error". With this change, we're waiting for the connection string to become available before we return from create-deployment.