[rt-devel] Extension testing fun and games

Dominic Hargreaves dom at earth.li
Thu May 7 18:26:25 EDT 2015


I've spent several evenings banging my head against the problem of running
the test suite of an RT extension against the installed version of RT,
in the context of Debian packaging. I've been down various ugly paths
and now I now have something which works, but it still needs a bit more work.

There are three patches involved:

Patch one (to RT):


(Load RT::Generated from @INC rather than hard-coding the location from

This seems sane enough, although I suspect it may break in some
installations. Maybe it should be wrapped in an



or some such. I'm not quite sure why it was originally done this way,
but given it is this way, breakage is likely.

Patch two (to RT):


(RT::Test: add $RTDatabaseType from the environment to the generated
RT_SiteConfig.pm if set).

Seems non-controversial.

Patch three (to the extension):


The most ugly. In particular this patch masks the real value of
$RT::VERSION. This could be hacked around with more layers of module
loading (to extra just $RT::VERSION from the installed RT::Generated)
and is clearly Debian-specific. I suspect a better solution would be to
find the installed RT::Generated, and then mangle it automatically to
change $VarPath, $MasonDataDir and $MasonSessionDir. Such an approach
could be moved out into RTx::Module::Install and then reused in a generic
fashion (obviously, enabled via an environment variable).

After all that, the test suite of RT-Extension-Assets passes when
invoked as:

perl Makefile.PL
RT_TEST_DB_TYPE=SQLite make test-parallel

I'd certainly be keen to see the test suites being run as a matter of
course in extensions, and this work looks as though it would be useful
outside the Debian contexts. At the moment unless I'm mistaken it appears
the test suites aren't really usable unless you've also got an installed
version of RT the test suite whose database the test suite is allowed to
poke at directly.

I'd be grateful for any thoughts people have about whether I'm going
down the right path, and whether patches with the modifications
suggested would be likely to be accepted upstream.


More information about the rt-devel mailing list