Skip to content

fix: wait for connection string when creating a deployment#1291

Merged
nirinchev merged 2 commits into
mainfrom
ni/atlas-local-sample-data
Jun 29, 2026
Merged

fix: wait for connection string when creating a deployment#1291
nirinchev merged 2 commits into
mainfrom
ni/atlas-local-sample-data

Conversation

@nirinchev

Copy link
Copy Markdown
Collaborator

Proposed changes

atlas-local-create-deployment would 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.

@nirinchev nirinchev requested a review from a team as a code owner June 28, 2026 13:49
@nirinchev nirinchev requested review from Copilot and cveticm and removed request for a team June 28, 2026 13:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) in src/common/managedTimeout.ts and replace scattered test setTimeout/timeout helpers 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.

Comment thread src/common/atlasLocal/connectionString.ts Outdated
@nirinchev nirinchev added the no-title-validation Add this label to disable the title check for this PR. label Jun 29, 2026
@nirinchev nirinchev merged commit 9b61b6c into main Jun 29, 2026
26 of 35 checks passed
@nirinchev nirinchev deleted the ni/atlas-local-sample-data branch June 29, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-title-validation Add this label to disable the title check for this PR. type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants