-
Notifications
You must be signed in to change notification settings - Fork 1
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
✨(dimail) send domain creation request to dimail #454
Conversation
59a7c38
to
e2c54de
Compare
e2c54de
to
874b085
Compare
src/backend/mailbox_manager/tests/api/mail_domain/test_api_mail_domains_create.py
Outdated
Show resolved
Hide resolved
de16b97
to
a7a0168
Compare
|
||
domain_name = "test.domain.fr" | ||
|
||
with responses.RequestsMock() as rsps: |
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.
Is there a reason, not to use the responses "classic" way? By classic I mean using the test function decorator responses.activate
along with
responses.add(
responses.POST,
url=re.compile(r".*/domains/"),
json={
"name": domain_name,
},
status=status.HTTP_201_CREATED,
)
which seems (to me) a bit more readable.
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 haven't had the time to make this PR but I absolutely want to make a fixture to encapsulate these responses !
I don't know responses.activate
but will try to investigate soon.
src/backend/mailbox_manager/tests/api/mail_domain/test_api_mail_domains_create.py
Show resolved
Hide resolved
timeout=10, | ||
) | ||
except requests.exceptions.ConnectionError as error: | ||
logger.error( |
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.
As error
is an exception, why don't you use logger.exception?
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.
Absolutely, I just didn't know there was a dedicated function but that's even better!
About this very line; I might change it for the error to be logged but the response to be passed as is (without exception).
a7a0168
to
2187788
Compare
0afbe86
to
ab0a4ef
Compare
Seems that the only thing we need is to spin up the dimail container, so I propose to pick up this PR. @sdemagny if you want to pair on this ? |
Apparently it's not that simple ? I've tried adding the Further, it seems that the dimail image in the registry hasn't been updated in some time, so in CI we are testing against outdated code. @chrnin Any ideas ? |
ab0a4ef
to
3617ab6
Compare
I think I have a pretty good idea now where this was going wrong. Not one single thing but a bunch of small fixes needed on both Régie and Dimail sides.
So this needs coordination between an update to this PR and an MR on Dimail. Stepping back from the nitty-gritty details, a bigger lesson for me is that unless coordination between Régie and Dimail development is more fluid (e.g. by trying cross-team pairing), the lead time for changes of this sort could be intolerably long: weeks to months… |
Fixes for Dimail submitted: https://gitlab.mim-libre.fr/dimail/dimail-api/-/merge_requests/51 |
Fixes pushed to this PR for the other points. Waiting on the MR to be merged on dimail side. |
743a6a5
to
c4221ec
Compare
a26833a
to
076a702
Compare
Finally good to go 🎉 after fixing a few remaining tests and changing inter-container communication in CI to use Docker's internal networking between app and Dimail. |
Send domain creation request to dimail when someone creates a domain in people.
Remove duplicate and catch errors more gracefully. Fixes tests accordingly.
Start the Dimail container (in CI and local testing) when starting the app. The pull_policy should have no effect on CI (because it starts from a blank slate) but ensure we test against the most recent version of the chosen tag.
Make testing easier in a local environment by adding Test credentials.
Adapt domain creationg request to latest protocol version, also make error reporting more robust: don't assume utf-8 but use the response's encoding, don't assume the error is JSON (it won't be when getting a 500) but reproduce the whole thing instead.
To help debug with Dimail interop, save logs from the Dimail container. Also fix the tests' expectations…
So that E2E tests in Github Actions can connect to Dimail container. Previously we were attempting to connect as if from the outside. But the E2E process is in fact inside the Docker Compose network. ("The tests came from inside the house !") https://tvtropes.org/pmwiki/pmwiki.php/Main/TheCallsAreComingFromInsideTheHouse
076a702
to
c294eb4
Compare
Purpose
Send domain creation request to dimail when someone creates a domain in people.
Proposal
Description...
...