Hi!

I've just merged #3970 <https://github.com/cyrusimap/cyrus-imapd/pull/3970>, 
which adds Cassandane::Tiny and converts the JMAP email and calendars tests to 
it.  Here's the deal:

Cassandane::Tiny is a tiny set of libraries that exist to let you split your 
big Cassandane test plugin into lots of little files, each containing one test. 
 We produced this because at Fastmail, we often merge several in-flight feature 
branches into one commit to be deployed.  When both branches add tests to (say) 
the end of JMAPEmail.pm, it means that our automated tooling hits a conflict.  
Or, equally annoyingly, our humans hit conflicts when rebasing.

By putting the tests into individual files, these conflicts become vastly less 
likely.

You can look at the commit that updates JMAPCalendars 
<https://github.com/cyrusimap/cyrus-imapd/commit/eed293a5b718e140ebde7d1dd51175b66b9ef480>
 to see how it looks.  Basically, all the "test" subs come out of the 
Cassandane plugin and go into files in "tiny-tests/PluginName".  Then the 
plugin gets this line:
use Cassandane::Tiny::Loader 'tiny-tests/PluginName';

To make conversion of plugins easier, I wrote tiny-test-splitter.pl 
<https://github.com/cyrusimap/cyrus-imapd/blob/master/cassandane/utils/tiny-test-splitter.pl>,
 which does a crude (but, so far, effective) job at pulling the plugin apart 
into tiny test files and the plugin's shared logic.  Note that you must review 
the diff to see whether there are things you need to fix by hand.  One of those 
things will always be adding the Loader line, which the splitter does not do.  
Also, you can see an example of me doing a fixup 
<https://github.com/cyrusimap/cyrus-imapd/commit/7445f141cd9d1bb85542ae869cb7660d63f839b3>
 where the splitter left a comment behind.

I think we can make further improvements, some described in the pull request, 
but I also think this is a pretty nice change.  Enjoy!

-- 
rjbs
------------------------------------------
Cyrus: Devel
Permalink: 
https://cyrus.topicbox.com/groups/devel/Taab28d1e3d062a2a-M3b4154ff366f21387f2da582
Delivery options: https://cyrus.topicbox.com/groups/devel/subscription

Reply via email to