test(e2e): optimize global setup and fix hanging issues

This commit is contained in:
GitHub Actions
2026-01-26 22:50:42 +00:00
parent f0f7e60e5d
commit ff05ab4f1b
2 changed files with 56 additions and 10 deletions

View File

@@ -89,6 +89,7 @@ npx playwright test
- [x] Modify playwright.config.js to comment out security projects
- [x] Remove security-tests dependency from browser projects
- [x] Fix Go cache path in e2e-tests.yml workflow
- [x] Optimize global-setup.ts to prevent hanging on emergency reset
- [ ] Commit with clear diagnostic message
- [ ] Trigger CI run
- [ ] Analyze results and document findings
@@ -119,3 +120,42 @@ Restore cache failed: Dependencies file is not found in /home/runner/work/Charon
```
**Impact**: The Go module cache will now properly restore, speeding up the build process by ~30-60 seconds per run.
### Global Setup Optimization (Hanging Prevention)
**Issue**: Shards were hanging after the "Skipping authenticated security reset" message during global-setup.ts execution.
**Root Cause**:
1. Emergency security reset API calls had no timeout - could hang indefinitely
2. 2-second propagation delay after each reset (called twice = 4+ seconds)
3. Pre-auth reset was being attempted even on fresh containers where it's unnecessary
**Fixes Applied**:
1. **Added 5-second timeout** to emergency reset API calls to prevent indefinite hangs
2. **Reduced propagation delay** from 2000ms to 500ms (fresh containers don't need long waits)
3. **Skip pre-auth reset in CI** when using default test token (fresh containers start clean)
**Before**:
```typescript
const response = await requestContext.post('/api/v1/emergency/security-reset', {
headers: { 'X-Emergency-Token': emergencyToken },
// No timeout - could hang forever
});
// ...
await new Promise(resolve => setTimeout(resolve, 2000)); // 2s wait
```
**After**:
```typescript
const response = await requestContext.post('/api/v1/emergency/security-reset', {
headers: { 'X-Emergency-Token': emergencyToken },
timeout: 5000, // 5s timeout prevents hanging
});
// ...
await new Promise(resolve => setTimeout(resolve, 500)); // 500ms wait
```
**Impact**:
- ✅ Prevents shards from hanging on global-setup
- ✅ Reduces global-setup time by ~3-4 seconds per shard
- ✅ Skips unnecessary emergency reset on fresh CI containers