- Notifications
You must be signed in to change notification settings - Fork1k
feat(cli): add mock SMTP server for testing scaletest notifications#20221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed byGraphite. Learn more aboutstacking. |
5830a76
to20790fc
Compareiferr:=s.smtpServer.Start();err!=nil { | ||
returnxerrors.Errorf("start SMTP server: %w",err) | ||
} | ||
s.smtpPort=s.smtpServer.PortNumber() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think you are doing this so that you can leave the port initially set to 0 and then later query the running port. It feels like a sharp edge, though, that s.SMTPAddress() will show you a 0 port until you start the server. Is there any reason why we don't want to just start the server immediately onNew()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm not a fan of allocating ports inNew()
. IMO It should only be responsible for initialization. We could removeNew()
and letStart()
handle init instead, since we don't do any complicated stuff in there. WDYT?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This PR adds a fake SMTP server for scale testing. It collects emails sent during tests, which you can then check using the HTTP API.
Changes
coder scaletest smtp
CLI commandHTTP API Endpoints
GET /messages?email=<email>
– Get messages sent to an email addressPOST /purge
– Clear all messages from memoryThe HTTP API parses raw email messages to extract thedate,subject, andnotification ID.
Notification IDs are sent in emails like this:
CLI
Flags:
--host
: Host for the mock SMTP and API server (default: localhost)--port
: Port for the mock SMTP server (random if not specified)--api-port
: Port for the HTTP API server (random if not specified)--purge-at-count
: Max number of messages before auto-purging (default: 100000)