Email verification tests become unreliable when every CI run shares the same inbox. A retry can consume the token from the first attempt, a parallel branch can read another branch's message, and an old message can make a broken flow look healthy.
I have had better results treating the test mailbox like a short-lived infrastructure resource. Each run gets an identity, a lease, and a cleanup rule. The application still sends a normal verification email, but the test knows exactly which inbox belongs to it.
Why email tests leak across CI runs
The usual shortcut is to configure one test address in a repository secret and poll it until a message arrives. It works on a quiet day. Under parallel CI, it creates a race:
build A -> shared inbox -> token A build B -> shared inbox -> token B build A reads whichever message arrives first
Enter fullscreen mode
Exit fullscreen mode
The problem is not only the inbox. Test state also lives in the application database, the Docker network, and the CI retry history.…