Why CI Email Tests Need a Canary Message
说明与用途
CI 邮件测试经常出现“未收到验证邮件”的模糊错误。通过在真实流程之前发送一个确定性的预警邮件(canary),可以区分环境/邮箱问题与应用交付问题,加速调试。
问题
CI email tests often fail with a vague “verification email not received” message, making it hard to identify whether the failure is due to the application, email provider, mailbox, or test runner.
结果
Adding a canary message splits failures into environment/mailbox problems and application delivery problems, reducing false positives and guiding faster debugging.
工作流
- Allocate a mailbox owned by the current test run
- Send a canary message with a unique subject
- Wait for the canary using normal polling code
- If canary arrives, execute the user-facing email flow
- Wait for the product email and assert its contents
- Classify failures with reason codes
- Record minimal artifacts for triage
- Release or schedule cleanup of the mailbox
证据
A small canary message makes this easier to diagnose. Before testing the real workflow, send a known message through the same inbox path and record whether it arrives.
If the canary fails, the result is probably an environment or inbox problem. If it passes but the verification message fails, the application path deserves attention.
Give the CI result a reason code instead of a generic timeout: canary_missing, product_missing, wrong_owner, late_delivery, invalid_token.
- 记录日期: 2026-11-01T04:13:55.240Z