Mocking the dbh context to fix it.
Created attachment 21130 [details] [review] Bug 10897 Removing DB dependence of t/ILSDI_Services.t To test 1/ Run the test with a config that doesnt allow db access you should get a message like t/ILSDI_Services.t .................. DBI connect('dbname=koha;host=localhost;port=3306','kohaadmin',...) failed: Access denied for user 'kohaadmin'@'localhost' (using password: YES) at /home/travis/build/ranginui/koha/blib/PERL_MODULE_DIR/C4/Context.pm line 810. 2/ Apply patch and run again 3/ Test should now run cleanly (cherry picked from commit c525dd384eba818076929cd20f10003c3b804111) Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Created attachment 21133 [details] [review] Bug 10897 Removing DB dependence of t/ILSDI_Services.t To test 1/ Run the test with a config that doesnt allow db access you should get a message like t/ILSDI_Services.t .................. DBI connect('dbname=koha;host=localhost;port=3306','kohaadmin',...) failed: Access denied for user 'kohaadmin'@'localhost' (using password: YES) at /home/travis/build/ranginui/koha/blib/PERL_MODULE_DIR/C4/Context.pm line 810. 2/ Apply patch and run again 3/ Test should now run cleanly (cherry picked from commit c525dd384eba818076929cd20f10003c3b804111) Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Going to push this into passed QA as it's a requirement for packages to build, and I've verified that it works on master.
For reference, a quick way to get a "config that doesnt allow db access" even if one's development environment is normally hooked up to a database is to do something like this: KOHA_CONF= prove -v ILSDI_Services.t I'll adjust the settings on Jenkins to (also) do exactly this for the non-DB-dependent tests to catch this situation in the future.
(In reply to Galen Charlton from comment #4) > For reference, a quick way to get a "config that doesnt allow db access" > even if one's development environment is normally hooked up to a database is > to do something like this: > > KOHA_CONF= prove -v ILSDI_Services.t > > I'll adjust the settings on Jenkins to (also) do exactly this for the > non-DB-dependent tests to catch this situation in the future. OK, in retrospect that's more extreme than just a config that lacks DB access.
I've pushed a different patch that simply removes t/ILSDI_Services.t; t/db_dependent/ILSDI_Services.t includes the module compilation test.
This patch has been pushed to 3.12.x, will be in 3.12.7. Thanks Galen!