Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(e2e): handle Docker build race condition and bump openai-zod4-compat timeout

jkomyno955892a2ff20
diff --git a/ts/e2e-tests/_utils/src/image-lifecycle.ts b/ts/e2e-tests/_utils/src/image-lifecycle.ts
index 466546ce4..906dd5907 100644
--- a/ts/e2e-tests/_utils/src/image-lifecycle.ts
+++ b/ts/e2e-tests/_utils/src/image-lifecycle.ts
@@ -202,8 +202,18 @@ export async function ensureNodeImage(
const built = await exec('docker', buildArgs, { cwd: repoRoot });
if (built.exitCode !== 0) {
+ // Handle race condition: concurrent builds may fail because another build
+ // already tagged the image. If the image now exists, treat it as success.
+ const output = built.stderr || built.stdout;
+ if (output.includes('already exists')) {
+ const recheck = await exec('docker', ['image', 'inspect', imageTag], { cwd: repoRoot });
+ if (recheck.exitCode === 0) {
+ return imageTag;
+ }
+ }
+
const err = new Error(`Failed to build Docker image ${imageTag}`);
- (err as Error & { cause: Error }).cause = new Error(built.stderr || built.stdout);
+ (err as Error & { cause: Error }).cause = new Error(output);
throw err;
}
@@ -366,8 +376,18 @@ export async function ensureDenoImage(
const built = await exec('docker', buildArgs, { cwd: repoRoot });
if (built.exitCode !== 0) {
+ // Handle race condition: concurrent builds may fail because another build
+ // already tagged the image. If the image now exists, treat it as success.
+ const output = built.stderr || built.stdout;
+ if (output.includes('already exists')) {
+ const recheck = await exec('docker', ['image', 'inspect', imageTag], { cwd: repoRoot });
+ if (recheck.exitCode === 0) {
+ return imageTag;
+ }
+ }
+
const err = new Error(`Failed to build Docker image ${imageTag}`);
- (err as Error & { cause: Error }).cause = new Error(built.stderr || built.stdout);
+ (err as Error & { cause: Error }).cause = new Error(output);
throw err;
}
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts b/ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts
index 0e513aaed..88c4caf20 100644
--- a/ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts
@@ -6,7 +6,6 @@
*/
import { e2e, type E2ETestResultWithSetup } from '@e2e-tests/utils';
-import { TIMEOUTS } from '@e2e-tests/utils/const';
import { describe, it, expect, beforeAll } from 'bun:test';
declare module 'bun' {
@@ -24,12 +23,13 @@ e2e(import.meta.url, {
defineTests: ({ runFixture }) => {
let result: E2ETestResultWithSetup;
+ // npm install inside Docker needs more time than the default TIMEOUTS.FIXTURE (60s)
beforeAll(async () => {
result = await runFixture({
filename: 'index.mjs',
setup: 'npm install --legacy-peer-deps',
});
- }, TIMEOUTS.FIXTURE);
+ }, 300_000);
describe('setup', () => {
it('npm install completes successfully', () => {