Bug 15150

Summary: t/ tests should pass if Test::DBIx::Class is not available
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Test SuiteAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: blocker    
Priority: P5 - low CC: f.demians, gmcharlt, hector.hecaxmmx, katrin.fischer, kyle.m.hall, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16582
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18851
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 15150: Make t/ tests skip if Test::DBIx::Class absent
[SIGNED-OFF] Bug 15150: Make t/ tests skip if Test::DBIx::Class absent
[PASSED QA] Bug 15150: Make t/ tests skip if Test::DBIx::Class absent

Description Tomás Cohen Arazi 2015-11-06 12:35:35 UTC
We need t/ to be skipped if they rely on Test::DBIx::Class and it is not available (this happens on the build environment, so we cannot build current master without fixing this).
Comment 1 Tomás Cohen Arazi 2015-11-06 13:36:26 UTC Comment hidden (obsolete)
Comment 2 Héctor Eduardo Castro Avalos 2015-11-06 15:05:21 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2015-11-06 15:20:36 UTC
Created attachment 44578 [details] [review]
[PASSED QA] Bug 15150: Make t/ tests skip if Test::DBIx::Class absent

Tests in t/ should always pass for building the Debian packages
for Koha. But we've started using Test::DBIx::Class for writing
mocked tests, and that lib is not (yet) packaged fro Debian 7+.

This means build is failing. Devs and jenkins use the lib from CPAN.

This patch makes the tests skip if the lib is absent.

To test:
- Install Test::DBIx::Class
  $ sudo cpanm Test::DBIx::Class
- Run the tests:
  $ prove t/
=> SUCCESS: Tests pass
- Uninstall Test::DBIx::Class
  $ sudo cpan -U Test::DBIx::Class
- Run the tests:
  $ prove t/
=> SUCCESS: Tests still pass (those needing the lib are skipped)
- Sign off :-D

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. All test pass successful

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Tomás Cohen Arazi 2015-11-06 15:27:41 UTC
Patch pushed to master.

Thanks Hector and Kyle for fast testing this one!
Comment 5 Frédéric Demians 2015-11-27 09:15:08 UTC
I don't understand whether this patch can/must be backported to 3.20.x.
Comment 6 Tomás Cohen Arazi 2015-11-27 14:33:54 UTC
(In reply to Frédéric Demians from comment #5)
> I don't understand whether this patch can/must be backported to 3.20.x.

As I see it, this has been bothering the Packaging manager for a while. He did some trick on building so the process (which runs the tests in t/) doesn't break.
If it applies on 3.20, it is a good thing to do (backporting it).
But maybe ask Galen, the new packaging manager.
Comment 7 Frédéric Demians 2015-11-27 15:20:46 UTC
(In reply to Tomás Cohen Arazi from comment #6)

> If it applies on 3.20, it is a good thing to do (backporting it).
> But maybe ask Galen, the new packaging manager.

This patch touches several tests that have changed (more tests). So the backporting is tricky.