Bug 10897 - t/ILSDI_Services.t is db dependent
Summary: t/ILSDI_Services.t is db dependent
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P2 major (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-16 23:58 UTC by Chris Cormack
Modified: 2014-05-26 21:04 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 10897 Removing DB dependence of t/ILSDI_Services.t (1.57 KB, patch)
2013-09-17 00:02 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 10897 Removing DB dependence of t/ILSDI_Services.t (1.62 KB, patch)
2013-09-17 02:54 UTC, Robin Sheat
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 2013-11-08 18:30:48 UTC
This patch has been pushed to 3.12.x, will be in 3.12.7.

Thanks Galen!