Commit e7d2a97
committed
test(e2e): add full e2e test suite and fix three production bugs found during testing
E2E tests (test/e2e/e2e_test.go):
- FullHappyPath: validates end-to-end wiring (PostbackURL, BotConfig propagation)
- DebounceAggregation: verifies buffer concatenation through the full HTTP→AI chain
- AIInterruption: exercises real HTTP cancellation integrated with pipeline context
- ResponseTime: validates NFR-05 (202 < 1s regardless of pipeline duration)
- ExactlyOnce: exercises Redlock under real goroutine pressure
- PipelineIsolation: verifies one pair's failure does not affect another
- DispatchSegmentation: validates BotConfig segmentation wiring to dispatch
- DispatchInterruption: verifies mid-dispatch cancellation drops remaining parts
- RecoveryAfterRestart: validates NFR-01 — debounce pairs survive a restart
- PostbackFailure: verifies state is cleared and no retry on non-2xx postback
Production bug fixes surfaced by the tests:
- PipelineState now persists BotConfig and PostbackURL at StageDebounce so
Start() recovery can reconstruct pipelineEntry correctly after restart (NFR-01)
- Removed entries.Delete from ErrDispatchInterrupted handler — it raced with the
replacement event's Store and deleted the new entry before launchAIStage loaded it
- Shutdown is now idempotent via sync.Once (close on closed channel panicked)
Test infrastructure:
- E2E suite uses Redis DB 14; unit tests use DB 15 — prevents FlushDB interference
when go test ./... runs packages concurrently1 parent e28c06a commit e7d2a97
3 files changed
Lines changed: 827 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | | - | |
29 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
118 | 130 | | |
119 | 131 | | |
120 | 132 | | |
| |||
154 | 166 | | |
155 | 167 | | |
156 | 168 | | |
157 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
158 | 177 | | |
159 | 178 | | |
160 | 179 | | |
| |||
402 | 421 | | |
403 | 422 | | |
404 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
405 | 427 | | |
406 | 428 | | |
407 | 429 | | |
408 | 430 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | 431 | | |
414 | 432 | | |
415 | 433 | | |
| |||
516 | 534 | | |
517 | 535 | | |
518 | 536 | | |
| 537 | + | |
| 538 | + | |
519 | 539 | | |
520 | 540 | | |
521 | 541 | | |
| |||
525 | 545 | | |
526 | 546 | | |
527 | 547 | | |
528 | | - | |
529 | | - | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
530 | 551 | | |
531 | 552 | | |
532 | 553 | | |
| |||
0 commit comments