Bug 10897

Summary: t/ILSDI_Services.t is db dependent
Product: Koha Reporter: Chris Cormack <chris>
Component: Architecture, internals, and plumbingAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P2 CC: robin, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 10897 Removing DB dependence of t/ILSDI_Services.t
Bug 10897 Removing DB dependence of t/ILSDI_Services.t

Description Chris Cormack 2013-09-16 23:58:55 UTC
Mocking the dbh context to fix it.
Comment 1 Chris Cormack 2013-09-17 00:02:02 UTC Comment hidden (obsolete)
Comment 2 Robin Sheat 2013-09-17 02:54:31 UTC
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>
Comment 3 Robin Sheat 2013-09-17 02:55:54 UTC
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.
Comment 4 Galen Charlton 2013-09-17 15:00:53 UTC
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.
Comment 5 Galen Charlton 2013-09-17 16:35:42 UTC
(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.
Comment 6 Galen Charlton 2013-09-17 16:37:48 UTC
I've pushed a different patch that simply removes t/ILSDI_Services.t; t/db_dependent/ILSDI_Services.t includes the module compilation test.
Comment 7 Tomás Cohen Arazi (tcohen) 2013-11-08 18:30:48 UTC
This patch has been pushed to 3.12.x, will be in 3.12.7.

Thanks Galen!