From 423d7d7b3411d8d8ac2b135db33dea362ad85a44 Mon Sep 17 00:00:00 2001 From: anandgupta42 Date: Wed, 18 Mar 2026 01:10:28 -0700 Subject: [PATCH] fix: Docker E2E tests skip in CI unless explicitly opted in GitHub Actions runners have Docker pre-installed, so isDockerAvailable() returns true. But the TypeScript CI job has no test databases running, causing 3 tests to hang for 60-90s then fail. Fix: require DRIVER_E2E_DOCKER=1 env var to run Docker-based tests. The driver-e2e CI job sets TEST_*_HOST vars (CI services), which still work. Local dev can set DRIVER_E2E_DOCKER=1 to test with Docker. This eliminates 3 of the 14 CI failures on main. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../opencode/test/altimate/drivers-docker-e2e.test.ts | 8 +++++++- packages/opencode/test/altimate/drivers-e2e.test.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/opencode/test/altimate/drivers-docker-e2e.test.ts b/packages/opencode/test/altimate/drivers-docker-e2e.test.ts index 8fe097b0b0..13b0b6eb1e 100644 --- a/packages/opencode/test/altimate/drivers-docker-e2e.test.ts +++ b/packages/opencode/test/altimate/drivers-docker-e2e.test.ts @@ -9,8 +9,14 @@ import { createConnection } from "net" const HAS_CI_SERVICES = !!(process.env.TEST_MYSQL_HOST || process.env.TEST_MSSQL_HOST || process.env.TEST_REDSHIFT_HOST) +// Only run Docker tests when explicitly opted in via DRIVER_E2E_DOCKER=1 +// or when CI services are configured. This prevents the TypeScript CI job +// (which has Docker but no test databases) from trying to start containers. +const DOCKER_OPT_IN = process.env.DRIVER_E2E_DOCKER === "1" + function isDockerAvailable(): boolean { - if (HAS_CI_SERVICES) return true // CI services replace Docker + if (HAS_CI_SERVICES) return true + if (!DOCKER_OPT_IN) return false // Skip unless explicitly opted in try { execSync("docker info", { stdio: "ignore", timeout: 3000 }) return true diff --git a/packages/opencode/test/altimate/drivers-e2e.test.ts b/packages/opencode/test/altimate/drivers-e2e.test.ts index 031063021c..e59dcf3807 100644 --- a/packages/opencode/test/altimate/drivers-e2e.test.ts +++ b/packages/opencode/test/altimate/drivers-e2e.test.ts @@ -34,6 +34,7 @@ function isBetterSqlite3Available(): boolean { function isDockerAvailable(): boolean { if (process.env.TEST_PG_HOST) return true // CI services replace Docker + if (!process.env.DRIVER_E2E_DOCKER) return false // Skip unless opted in try { execSync("docker info", { stdio: "ignore", timeout: 3000 }) return true