diff --git a/.github/workflows/e2e-tests-full.yml b/.github/workflows/e2e-tests-full.yml index b34410e8f..ad213cf24 100644 --- a/.github/workflows/e2e-tests-full.yml +++ b/.github/workflows/e2e-tests-full.yml @@ -28,6 +28,13 @@ jobs: matrix: cdk-source: [npm, main] shard: ['1/6', '2/6', '3/6', '4/6', '5/6', '6/6'] + env: + # Scheduled runs cover 6 priority suites spanning CodeZip, Container, Auth, + # Evals, Import, and local Dev paths. Manual workflow_dispatch runs the + # full e2e directory to exercise every framework/model-provider combo. + SCHEDULED_TESTS: >- + e2e-tests/strands-bedrock.test.ts e2e-tests/container-strands-bedrock.test.ts e2e-tests/byo-custom-jwt.test.ts + e2e-tests/evals-lifecycle.test.ts e2e-tests/import-resources.test.ts e2e-tests/dev-lifecycle.test.ts steps: - uses: actions/checkout@v6 with: @@ -79,7 +86,14 @@ jobs: OPENAI_API_KEY: ${{ env.E2E_OPENAI_API_KEY }} GEMINI_API_KEY: ${{ env.E2E_GEMINI_API_KEY }} CDK_TARBALL: ${{ env.CDK_TARBALL }} - run: npx vitest run --project e2e --shard=${{ matrix.shard }} + run: | + if [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "Scheduled run: executing priority e2e suites" + npx vitest run --project e2e --shard=${{ matrix.shard }} $SCHEDULED_TESTS + else + echo "Manual/push run: executing full e2e suite" + npx vitest run --project e2e --shard=${{ matrix.shard }} + fi browser-tests: runs-on: ubuntu-latest environment: e2e-testing diff --git a/integ-tests/dev-server.test.ts b/integ-tests/dev-server.test.ts index 4b07b7284..8133ae949 100644 --- a/integ-tests/dev-server.test.ts +++ b/integ-tests/dev-server.test.ts @@ -69,18 +69,43 @@ describe('integration: dev server', () => { } }, 120000); - afterEach(() => { - // Kill dev server if running - if (devProcess) { - devProcess.kill('SIGTERM'); - devProcess = null; + async function terminateDevProcess(timeoutMs = 5000): Promise { + if (!devProcess) return; + const proc = devProcess; + devProcess = null; + + if (proc.pid) { + try { + process.kill(-proc.pid, 'SIGTERM'); + } catch { + // Process group already exited + } } + + await new Promise(resolve => { + const timer = setTimeout(() => { + if (proc.pid) { + try { + process.kill(-proc.pid, 'SIGKILL'); + } catch { + // Already dead + } + } + resolve(); + }, timeoutMs); + proc.on('exit', () => { + clearTimeout(timer); + resolve(); + }); + }); + } + + afterEach(async () => { + await terminateDevProcess(); }); afterAll(async () => { - if (devProcess) { - devProcess.kill('SIGKILL'); - } + await terminateDevProcess(); await rm(testDir, { recursive: true, force: true }); }); @@ -95,15 +120,14 @@ describe('integration: dev server', () => { devProcess = spawn('node', [cliPath, 'dev', '--port', String(port), '--logs'], { cwd: projectPath, stdio: 'pipe', + detached: true, env: { ...process.env, INIT_CWD: undefined }, }); const serverReady = await waitForServer(port, 20000); expect(serverReady, 'Dev server should respond to ping within 20s').toBeTruthy(); - // Clean shutdown - devProcess.kill('SIGTERM'); - devProcess = null; + await terminateDevProcess(); }, 30000 );