cyrusimap / cassandane

Other
6 stars 11 forks source link

Run JMAP-TestSuite both with websockets and without #147

Closed elliefm closed 2 years ago

elliefm commented 2 years ago

Currently, you can run the JMAP-TestSuite tests either using websockets, or not using websockets, by setting the JMTS_USE_WEBSOCKETS environment variable to control its behaviour. But this means to exercise both variants, you need to run Cassandane twice.

This PR duplicates the existing JMAPTestSuite suite, as JMAPTestSuiteWS. The original JMAPTestSuite now overrides the environment to ensure websockets are not used, and the new JMAPTestSuiteWS overrides the environment to make sure they are.

JMAPTestSuiteWS checks for the availability of JMAP::Tester::WebSocket, and only enables its tests if it's available. So if you don't presently have JMAP::Tester::WebSocket installed (like I didn't) it won't blow up in your face, JMAPTestSuiteWS just won't run any tests. Or, more precisely, it will run one passing test that just logs a message that the module is unavailable, like what we already do if JMAP support wasn't compiled into Cyrus or JMAP-TestSuite isn't configured.

Adds a dependency on Module::Load::Conditional, but it looks like this has been in perl core for a long time, so you probably already have it.