From e2d6b051898e7c5c8f93404a2f6baf1040a111dd Mon Sep 17 00:00:00 2001 From: Pierre Merlet Date: Thu, 29 Oct 2026 17:27:03 +0100 Subject: [PATCH] ci: wait for the ssh test containers to accept connections before testing 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 --- .github/workflows/build.yml | 2 +- packages/datasource-mongo/docker-compose.yml | 6 ++++++ packages/datasource-sql/docker-compose.yml | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 229658e385..eb2f6b2bb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,7 +92,7 @@ jobs: node-version-file: ".nvmrc" - name: Start docker containers if: ${{ matrix.package == 'datasource-mongo' || matrix.package == 'datasource-mongoose' || matrix.package == 'datasource-sql' || matrix.package == 'datasource-sequelize' || matrix.package == 'datasource-dynamodb' }} - run: docker compose -f ./packages/${{ matrix.package }}/docker-compose.yml up -d; sleep 5 + run: docker compose -f ./packages/${{ matrix.package }}/docker-compose.yml up -d --wait --wait-timeout 180 - name: Restore dependencies from cache uses: actions/cache/restore@v4 with: diff --git a/packages/datasource-mongo/docker-compose.yml b/packages/datasource-mongo/docker-compose.yml index 034bd27103..b7b091b17c 100644 --- a/packages/datasource-mongo/docker-compose.yml +++ b/packages/datasource-mongo/docker-compose.yml @@ -25,3 +25,9 @@ services: - ./test/ssh-config:/config ports: - '2224:2222' + healthcheck: + # sshd only listens once the tunnel mod is downloaded and host keys are generated + test: ['CMD', 'ssh-keyscan', '-p', '2222', '127.0.0.1'] + interval: 2s + timeout: 5s + retries: 60 diff --git a/packages/datasource-sql/docker-compose.yml b/packages/datasource-sql/docker-compose.yml index 02a11e1202..b47248ab9e 100644 --- a/packages/datasource-sql/docker-compose.yml +++ b/packages/datasource-sql/docker-compose.yml @@ -96,3 +96,9 @@ services: - ./test/ssh-config:/config ports: - '2222:2222' + healthcheck: + # sshd only listens once the tunnel mod is downloaded and host keys are generated + test: ['CMD', 'ssh-keyscan', '-p', '2222', '127.0.0.1'] + interval: 2s + timeout: 5s + retries: 60