Menu

Isolate Email Tests in Docker CI on AWS
📰

Isolate Email Tests in Docker CI on AWS

DEV Community: cicd·jasonmills94·17 days ago
#qcrv0WQo
#devtocicd#devto#dev#test#lease
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.