Skip to content

ci: wait for the ssh test containers to accept connections before testing - #2050

Merged
PMerlet merged 1 commit into
mainfrom
ci/wait-for-ssh-containers
Oct 29, 2026
Merged

PMerlet merged 1 commit into
mainfrom
ci/wait-for-ssh-containers

Conversation

@PMerlet

@PMerlet PMerlet commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Problem

Linting & Testing (datasource-mongo) fails intermittently on main (run 40909579341, attempt 1): the 3 tests in test/index.ssh.integration.test.ts fail with read ECONNRESET on 127.0.0.1:2224, then pass on re-run.

The linuxserver/openssh-server container downloads its DOCKER_MODS tunnel mod from ghcr and generates host keys before sshd listens. CI only did up -d; sleep 5; with a warm dependency cache the SSH tests started 38 s after the container, while Docker already published the port with nothing listening behind it.

Fix

  • ssh-keyscan healthcheck on the ssh-server service of datasource-mongo and datasource-sql (same image, same mod): it checks sshd answers with its banner, not just that the port is open.
  • CI starts the containers with docker compose up -d --wait --wait-timeout 180 instead of sleep 5; services without a healthcheck are waited on until running.

Verified locally

  • ssh-keyscan exits 0 when sshd listens and 1 on a closed port.
  • SSH integration tests: 5/5 green, 3 times in a row, each on freshly recreated containers.
  • up --wait succeeds with the datasource-dynamodb compose too; datasource-sql compose config validates.

🤖 Generated with Claude Code

Note

Add SSH container healthchecks and wait for readiness in CI

The CI matrix job previously slept a fixed 5 seconds after starting Compose services. It now waits for containers to reach a healthy state, timing out after 180 seconds.

  • Adds an SSH healthcheck to the mongo and sql datasource Compose files. It probes port 2222 with ssh-keyscan every 2 seconds, with a 5-second timeout and 60 retries.
  • Risk: CI SSH test steps now fail if containers are not healthy within 180 seconds, instead of proceeding after the fixed delay in build.yml.

Macroscope summarized e2d6b05.

…ting

The linuxserver openssh-server image downloads its tunnel mod and generates
host keys before sshd listens, so the fixed `sleep 5` let the mongo SSH
integration tests hit a published port with nothing behind it (ECONNRESET).
An ssh-keyscan healthcheck plus `docker compose up --wait` makes the job
wait until sshd answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qltysh

qltysh Bot commented Oct 29, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@PMerlet
PMerlet merged commit 5f55374 into main Oct 29, 2026
34 checks passed
@PMerlet
PMerlet deleted the ci/wait-for-ssh-containers branch October 29, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants