跪拜 Guibai
← All articles
Backend · GitHub · Testing

One Full-Path E2E Run: 20 Symptoms, 5 Root Causes, All Missed by Unit Tests

By 一条Go ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Unit tests can't catch defects that live in the seams between modules; this setup does, and then converts each discovery into a regression test so the CI stops the recurrence. The cost is slower full runs via workers:1, which the author argues is the right trade for a self-hosted platform.

Summary

Full-path e2e testing fills the gap unit tests leave open: each module works, but assembled behavior breaks. One run against Alioth's platform surfaced twenty UI anomalies. Debugging collapsed them to five root causes, from a target-group update that dropped new targets to a missing retry on K8s 409 conflicts. None was a wrong function; each was two correctly written modules operating on mismatched assumptions.

The post spells out the enabling mechanics. Login is bypassed by locally minting a JWT and injecting it with Playwright's storageState, with the caveat that login-specific flows need separate real-login tests. Test data is created and deleted via API, never by clicking the UI, and workers is set to 1 so the shared database stays consistent. Fixes were ordered by data semantics first, then concurrency, then default-value timing, and each root cause got a millisecond-scale unit test at the data layer. E2E finds, unit tests lock.

Practical pitfalls round it out: keep traces on failure, set retries to zero so flakiness becomes a red signal instead of being hidden, use the system Chrome, and keep expect timeouts shorter than API timeouts. Cleanup failures must be logged, or leftover data surfaces as unrelated test failures next run.

Takeaways
— Alioth mints a JWT locally and injects it via Playwright's storageState to skip login, but excludes login-specific flows like captcha rate limiting from this fixture.
— Test data is created and cleaned through API calls, never by clicking the UI, and each case names its data with Date.now() to avoid collision in the shared database.
— The e2e configuration uses workers:1 to prevent parallel tests from stepping on each other, trading speed for stability.
— One full run produced 20 UI anomalies that reduced to 5 root causes: target-group merge semantics, missing 409 retry in Kubernetes, a data-layer enum switch missing SYSTEM_READONLY, default values applying before validation for availability alerts, and batch intervene returning success on unknown event uids.
— None of the five root causes was a function written incorrectly; each was a mismatch between two correctly implemented assumptions.
— Fixes were applied in a deliberate order: data-layer semantics first, concurrency retry second, then default-value ordering, with UI changes deferred until the backend was correct.
— The fix commit added 4 test files and +1022 lines, including data-layer regression tests that pin the root causes in milliseconds rather than in e2e runs.
— Pitfalls include retaining traces on failure, setting retries to 0 to expose flakiness, using the system Chrome, keeping expect timeouts shorter than API timeouts, and logging cleanup failures instead of swallowing them.
Conclusions

The classification of all five root causes as mismatched assumptions rather than code errors suggests integration testing's primary value is exposing contract boundaries, not finding individual bugs.

Fixing data semantics before UI is a deliberate ordering: because UI is just a projection of backend behavior, addressing the root layer first makes later UI fixes explainable and avoids false starts.

The decision to keep retries at zero is a strong stance: flakiness is treated as a real defect rather than something to tolerate, which forces the team to address timing and race conditions instead of masking them.

Using unit tests at the data layer to lock fixes, rather than more e2e, trades a 10-second test for a millisecond one, making regression detection fast enough to run on every edge case.

Concepts & terms
Full-path e2e
End-to-end testing that exercises the entire stack from UI through backend, placing non-adjacent modules in one shared runtime state to reveal defects caused by mismatched assumptions between correctly written components.
Optimistic concurrency
A pattern where a write succeeds only if the version hasn't changed since the read; on a 409 conflict, the client must fetch fresh data and retry. In the article, the Kubernetes workload image update failed because that retry loop was missing.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗