Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Add support for testing JMAP in a murder setup #151

Merged
merged 7 commits into from
Sep 10, 2021

Conversation

elliefm
Copy link
Contributor

@elliefm elliefm commented Aug 25, 2021

This is for cyrusimap/cyrus-imapd#3564

We have a small handful of very basic tests for murder setups (Murder.pm), but the way we set things up in Cassandane meant these could only use IMAP.

This PR adjusts the infrastructure so that a test can either require an IMAP murder or a JMAP murder (but not both!), modifies the existing Murder.pm tests to use the new infrastructure, and adds a couple of basic JMAP tests too.

We can and should add more tests to this, but so far this proves that the basic premise -- connecting to the frontend, making a JMAP request, and the request being proxied to the backend containing the user's account -- seems to work.

There's probably more to do with the infrastructure yet, but I won't be sure what it needs to look like until we write and debug more tests.

@elliefm
Copy link
Contributor Author

elliefm commented Aug 25, 2021

realised in the shower that I also want some kinda test_jmap_backend_commands test that verifies that connections directly to the backend don't get proxied, so I'll add that on friday

Copy link
Contributor

@ksmurchison ksmurchison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and WFM

@elliefm elliefm force-pushed the jmap-murder-support branch 2 times, most recently from 0e19e0e to ac0d731 Compare August 27, 2021 00:12
@elliefm
Copy link
Contributor Author

elliefm commented Aug 27, 2021

It occurs to me that this is not really "JMAP" murder so much as it is "HTTP" murder, and we could use the same mechanism to test DAV-in-murder functionality (if that's a thing; I assume it is but don't really know either way).

So I'm tempted to rename jmapmurder (et al) to httpmurder (et al) now.

If I do that, I probably will split the Murder.pm test suite into separate IMAPMurder.pm and JMAPMurder.pm, allowing for the possibility of additional *DavMurder.pm suites later. Because I think having all those protocols tested in one suite will get real cluttered and hard to maintain.

@elliefm elliefm marked this pull request as draft August 27, 2021 00:22
@ksmurchison
Copy link
Contributor

Yes. HTTP Murder makes more sense

@elliefm elliefm force-pushed the jmap-murder-support branch from ac0d731 to 928d602 Compare August 27, 2021 03:26
@elliefm elliefm force-pushed the jmap-murder-support branch 2 times, most recently from 8609516 to 5450f1b Compare September 3, 2021 06:16
@elliefm
Copy link
Contributor Author

elliefm commented Sep 3, 2021

Mostly refactored, but I need to set up caldavtester and make sure I haven't broken it, which I might have! Next week...

@elliefm
Copy link
Contributor Author

elliefm commented Sep 8, 2021

Looks like I haven't broken caldavtester, whew

@elliefm
Copy link
Contributor Author

elliefm commented Sep 8, 2021

Wait, it was TesterCardDAV that was having problems, not TesterCalDAV. Checking again...

@elliefm elliefm force-pushed the jmap-murder-support branch from 5450f1b to 26154ad Compare September 8, 2021 00:45
@elliefm
Copy link
Contributor Author

elliefm commented Sep 8, 2021

Turns out TesterCardDAV was broken by only enabling "carddav" httpmodule, when it appears that module is dependent on "caldav" too. Have opened cyrusimap/cyrus-imapd#3649 which updates the documentation to reflect this.

@elliefm elliefm force-pushed the jmap-murder-support branch from 26154ad to f17d38d Compare September 8, 2021 01:31
@elliefm elliefm marked this pull request as ready for review September 8, 2021 01:32
@elliefm elliefm requested a review from ksmurchison September 8, 2021 01:32
@elliefm
Copy link
Contributor Author

elliefm commented Sep 8, 2021

@ksmurchison I've now refactored the murder setup stuff like we talked about. Can you review again please?

Copy link
Contributor

@ksmurchison ksmurchison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks great!

We could add a JMAP test that uploads a blob via the frontend and download via the backend or vice-versa.

And for completeness, we could add tests via the frontend that GET The session object and do a POST of an API request (something as simple as Core/echo).

I will fix the CardDAV module issue

These are mutually exclusive for now because Cyrus doesn't properly
support proxying to backend services on nonstandard ports, and
Cassandane requires nonstandard ports, and the way we make it work
under Cassandane at all is a nasty hack that can only work for one
service at a time.
Rename to make it more closely describe what it's actually doing,
and make it decide which to setup based on the test's http service
configuration, rather than simply whether $want->{jmap} is set.
This was breaking because _setup_http_service_objects would try to
initialise a Net::CardDAV object without being fully set up.

Same again for TesterCalDAV for symmetry, though it didn't have the same
problem.
@elliefm
Copy link
Contributor Author

elliefm commented Sep 10, 2021

Oh those are great test ideas, thanks. I've put them into #160 and I'll tackle them as a separate PR.

This one can be merged whenever we're about to merge cyrusimap/cyrus-imapd#3564

@ksmurchison ksmurchison merged commit 5c159a2 into cyrusimap:master Sep 10, 2021
@elliefm elliefm deleted the jmap-murder-support branch September 12, 2021 23:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants