-
Notifications
You must be signed in to change notification settings - Fork 66
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smtp affair #4050
Smtp affair #4050
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4050 +/- ##
=======================================
Coverage 78.72% 78.72%
=======================================
Files 284 284
Lines 13009 13009
Branches 2897 2897
=======================================
Hits 10241 10241
Misses 2768 2768
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Need to find a solution to the e2e smtp child process failing on GH CI due to the process spawning successfully but is still pulling the smtp server container. This is not happening locally because the container is already available. The forge app boots up in the meantime and fails to verify an email connection, sets global config to email disabled causing issues with e2e tests. e2e logs: [STARTED] Task without title.
/usr/local/bin/npm run cy:web-server:os
> @flowfuse/flowfuse@2.5.0 cy:web-server:os
> node ./test/e2e/frontend/test_environment_os
Mailpit: Starting e-mail server...
Mailpit: Web UI available at http://localhost:8025/ with SMTP listening on port 1025
Mailpit: Unable to find image 'axllent/mailpit:latest' locally
[SUCCESS] Task without title.
Opening Cypress...
Mailpit: latest: Pulling from axllent/mailpit
[2024-06-20T17:03:58.141Z] ERROR: Failed to verify email connection: Error: connect ECONNREFUSED 127.0.0.1:1025
DevTools listening on ws://127.0.0.1:32915/devtools/browser/0c4a2cb1-9f61-4cb6-a50e-89a3c51ae827
Mailpit: d25f557d7f31: Already exists
ee12d611a4de: Pulling fs layer
d4b283bca91a: Pulling fs layer
d4b283bca91a: Verifying Checksum
d4b283bca91a: Download complete
ee12d611a4de: Verifying Checksum
ee12d611a4de: Download complete
ee12d611a4de: Pull complete
d4b283bca91a: Pull complete
Digest: sha256:d1402e182df9a21a97441f545e01a1290290b0ee68f8ae3e595017b9a162348c
Status: Downloaded newer image for axllent/mailpit:latest My current and best solution so far is to wait for the smtp server stdout message. dockerProcess.stdout.on('data', (data) => {
if (data.toString().includes('accessible via http://localhost')) {
resolve(dockerProcess)
}
}) The alternative would be what @hardillb & @ppawlowski proposed to run the smtp server as a separate CI service, but that would mean making changes to the npm scripts to create separate CI scripts that do not run the smtp server. What we'd need to take into account is the compute time it would take for both scenarios and how GH would bill them and take a decision based on that @ppawlowski @hardillb, I'd love some input on this. |
Regarding GitHub Actions billing time - IMO it does not matter how you spin up the dependent service, the billing time will remain the same. |
The service container approach would definitely solve the CI issue along with parallel runs but would complicate the run scripts locally. Currently I'm spinning a smtp server per test environment due to cypress configuration inheritance. This results with two smtp servers spinning (1025/8025 for os e2e and 1026/8026 for ee e2e environments) when running the entire suite or a single dedicated one when running a single environment. This is being reflected in GH actions as well, a smtp server being spun up for each environment run. From what i can tell after reading the docs is if the service container is created for each job on a runner so there will be a single smpt service for both e2e environments (which would be desired) The ideal outcome:
As we stand:
Any pointers on how to address these would be welcomed. The ci part is straight forward, the local part is what I consider to be tricky because I don't want to add additional overhead when running tests locally (ex spinning the smtp server manually). My best idea so far would be to double the cy:webserver commands and alter them for CI use where they don't spin up the smtp server but don't like the duplication part as we already have a lot of script entries |
…figuration for smtp
made some alterations to the code to run the smtp server as a service in CI runs |
@hardillb @ppawlowski could one of you take a look at this please, at your earliest convenience. It's blocking a couple of other PRs |
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.
Couple of questions to check I've got everything
webPort: process.env.SMTP_WEB_PORT || 8025 | ||
} | ||
|
||
if (!process.env.NO_SMTP_SERVER) { |
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.
Just want to be clear on this
The env var is called NO_SMTP_SERVER
and is set to true
in the GH Action setup,
This if
will evaluate if set to false
?
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 relied on the fact that this env var will not be set anywhere else but CI and didn't take into account what values might be passed in. You are right though, it will evaluate to true no matter what value you'd pass.
I'll make it more concise
@joepavitt @cstns Approved, can be merged when suits the other PRs |
@joepavitt @cstns actually scratch that the UI tests have failed |
my bad, was not careful when updated the if statement. The tests failed due to a port clash because the smtp child process started |
Description
separating pr
already reviewed in: #4045
Related Issue(s)
Checklist
flowforge.yml
?FlowFuse/helm
to update ConfigMap TemplateFlowFuse/CloudProject
to update values for Staging/ProductionLabels
area:migration
label