cyrusimap / cassandane

Other
6 stars 11 forks source link

Two searchfuzzy tests fail when cyrus is configured without xapian #55

Closed jasontibbitts closed 6 years ago

jasontibbitts commented 6 years ago

This was mentioned on IRC and I figured I would open a ticket for it. If I remove --with-xapian from the configure call when I build Cyrus, I find that the following two Cassandane tests will fail: SearchFuzzy.noindex_multipartheaders and SearchFuzzy.xattachmentname.

Checking the code for those two tests, I see the set_up() function does have code that checks for xapian and sort of implies that the relevant tests will be skipped entirely. Indeed, the errror log includes:

=====> Cyrus::SearchFuzzy[65] No xapian support enabled. Skipping tests.

but I don't think just returning from set_up() skips anything. Not sure how this could be handled better given the limitations of the test framework involved, though I do see some tests that mess with the list_tests function to skip a block of tests so you get:

Cyrus::TesterCardDAV.warning_caldavtester_is_not_installed              [  OK  ]
elliefm commented 6 years ago

In this case the SearchFuzzy set_up() function sets a $self->{test_fuzzy_search} = 1 flag (unless it returns early due to no xapian), and all the test functions check for this flag -- except for the two in question. I've fixed them by adding the check.

You're right, another way to achieve a similar thing would be to mess with the listtests function, but then you've gotta either keep a record of the tests (vs letting Test::Unit introspect for "test" function names), or duplicate the introspection code, so there's upsides and downsides on every side!

The TesterFoo suites all call out to some external tester, which provides a way to query the list of tests, so the pattern they use works out fairly well for them, but doesn't translate 1:1 to Cassandane-native tests