Skip to content

Commit 2f27d6c

Browse files
committed
test: trim scheduled e2e matrix and harden dev-server process cleanup
Scheduled Monday e2e run now targets 6 priority suites covering CodeZip, Container, custom JWT auth, evals, import, and local dev paths. Manual workflow_dispatch still runs the full e2e directory to exercise every framework/model-provider combo. Halves weekly AWS test burn from 6 shards of the full suite to 6 shards of the priority subset. Replace fire-and-forget SIGTERM in integ-tests/dev-server.test.ts with a process-group-aware terminator that: signals the whole group via -pid, waits on the child's exit event, and SIGKILLs the group after a 5s timeout if the process hangs. Spawn now uses detached:true so the process-group signal actually reaches subprocesses of the dev server.
1 parent 4f464d7 commit 2f27d6c

2 files changed

Lines changed: 54 additions & 12 deletions

File tree

.github/workflows/e2e-tests-full.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ jobs:
2828
matrix:
2929
cdk-source: [npm, main]
3030
shard: ['1/6', '2/6', '3/6', '4/6', '5/6', '6/6']
31+
env:
32+
# Scheduled runs cover 6 priority suites spanning CodeZip, Container, Auth,
33+
# Evals, Import, and local Dev paths. Manual workflow_dispatch runs the
34+
# full e2e directory to exercise every framework/model-provider combo.
35+
SCHEDULED_TESTS: >-
36+
e2e-tests/strands-bedrock.test.ts
37+
e2e-tests/container-strands-bedrock.test.ts
38+
e2e-tests/byo-custom-jwt.test.ts
39+
e2e-tests/evals-lifecycle.test.ts
40+
e2e-tests/import-resources.test.ts
41+
e2e-tests/dev-lifecycle.test.ts
3142
steps:
3243
- uses: actions/checkout@v6
3344
with:
@@ -79,7 +90,14 @@ jobs:
7990
OPENAI_API_KEY: ${{ env.E2E_OPENAI_API_KEY }}
8091
GEMINI_API_KEY: ${{ env.E2E_GEMINI_API_KEY }}
8192
CDK_TARBALL: ${{ env.CDK_TARBALL }}
82-
run: npx vitest run --project e2e --shard=${{ matrix.shard }}
93+
run: |
94+
if [[ "${{ github.event_name }}" == "schedule" ]]; then
95+
echo "Scheduled run: executing priority e2e suites"
96+
npx vitest run --project e2e --shard=${{ matrix.shard }} $SCHEDULED_TESTS
97+
else
98+
echo "Manual/push run: executing full e2e suite"
99+
npx vitest run --project e2e --shard=${{ matrix.shard }}
100+
fi
83101
browser-tests:
84102
runs-on: ubuntu-latest
85103
environment: e2e-testing

integ-tests/dev-server.test.ts

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,43 @@ describe('integration: dev server', () => {
6969
}
7070
}, 120000);
7171

72-
afterEach(() => {
73-
// Kill dev server if running
74-
if (devProcess) {
75-
devProcess.kill('SIGTERM');
76-
devProcess = null;
72+
async function terminateDevProcess(timeoutMs = 5000): Promise<void> {
73+
if (!devProcess) return;
74+
const proc = devProcess;
75+
devProcess = null;
76+
77+
if (proc.pid) {
78+
try {
79+
process.kill(-proc.pid, 'SIGTERM');
80+
} catch {
81+
// Process group already exited
82+
}
7783
}
84+
85+
await new Promise<void>(resolve => {
86+
const timer = setTimeout(() => {
87+
if (proc.pid) {
88+
try {
89+
process.kill(-proc.pid, 'SIGKILL');
90+
} catch {
91+
// Already dead
92+
}
93+
}
94+
resolve();
95+
}, timeoutMs);
96+
proc.on('exit', () => {
97+
clearTimeout(timer);
98+
resolve();
99+
});
100+
});
101+
}
102+
103+
afterEach(async () => {
104+
await terminateDevProcess();
78105
});
79106

80107
afterAll(async () => {
81-
if (devProcess) {
82-
devProcess.kill('SIGKILL');
83-
}
108+
await terminateDevProcess();
84109
await rm(testDir, { recursive: true, force: true });
85110
});
86111

@@ -95,15 +120,14 @@ describe('integration: dev server', () => {
95120
devProcess = spawn('node', [cliPath, 'dev', '--port', String(port), '--logs'], {
96121
cwd: projectPath,
97122
stdio: 'pipe',
123+
detached: true,
98124
env: { ...process.env, INIT_CWD: undefined },
99125
});
100126

101127
const serverReady = await waitForServer(port, 20000);
102128
expect(serverReady, 'Dev server should respond to ping within 20s').toBeTruthy();
103129

104-
// Clean shutdown
105-
devProcess.kill('SIGTERM');
106-
devProcess = null;
130+
await terminateDevProcess();
107131
},
108132
30000
109133
);

0 commit comments

Comments
 (0)