Bug 18226 introduces a regression for a problem fixed in Bug 15150. Test::DBIx::Class is not mandatory because it is not available in Debian, packaging of Koha is broken because of the use in t/00-load.t.
My bad, I completely forgot that this module was not packaged. So we have a problem here, the way we mocked our DB was not reliable and we fixed it using Test::DBIx::Class. Olli, Tomas, Marcel, any ideas?
Ok, I am on it.
Created attachment 64830 [details] [review] Bug 18851: Database handler must not be created at runtime
Created attachment 64831 [details] [review] Bug 18851: Test::DBIx::Class is not needed in 00-load.t
Created attachment 64832 [details] [review] Bug 18851: Tests must be skipped in cardnumber.t if Test::DBIx::Class is not installed
Mirko, could you confirm these patches fix the problem?
non-dependent tests must be tested with and without Test::DBIx::Class and with and without the DBMS running
Problems with missing Test::DBIx::Class are still present in t/Patron.t t/Search.t t/SuggestionEngine_AuthorityFile.t Additionally there are a lot of tests failing because of missing DB. They should be skipped if DB is not available.
Created attachment 64913 [details] build log: tests Attached file: build log: tests. Problems with Test::DBIx::Class and missing DB
I do not recreate the DB issues: prove t/Biblio.t t/Biblio2.t t/Biblio.t ... skipped: Need Test::DBIx::Class t/Biblio2.t .. ok All tests successful. Files=2, Tests=2, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.42 cusr 0.18 csys = 0.62 CPU) Result: PASS mysql is stopped and Test::DBIx::Class is not installed.
Created attachment 64979 [details] [review] Bug 18851: Fix 3 other tests
I recreated the "Can't connect to MySQL server" errors, but actually they existed before bug 18266, there is nothing new here.
(In reply to Jonathan Druart from comment #13) > I recreated the "Can't connect to MySQL server" errors, but actually they > existed before bug 18266, there is nothing new here. Thanks. It must have been pushed around the same time then I guess. Last working nightly was June 5.
Tests pass with the latest patch, nightly package + patch build works. I still get the DB messages, but they seem to be only warnings then. Thanks! I'll do a signoff when I get near a dev machine.
Created attachment 64990 [details] [review] Bug 18851: Database handler must not be created at runtime Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Created attachment 64991 [details] [review] Bug 18851: Test::DBIx::Class is not needed in 00-load.t Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Created attachment 64992 [details] [review] Bug 18851: Tests must be skipped in cardnumber.t if Test::DBIx::Class is not installed Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Created attachment 64993 [details] [review] Bug 18851: Fix 3 other tests Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
These all work for me, however, t/Koha_ExternalContent_OverDrive.t fails for me without a db. Can you test with WebService::ILS::OverDrive::Patron installed and verify?
Created attachment 65199 [details] [review] Bug 18851: Make OverDrive.T pass if dbms is not running
With SQL stopped and no Test::DBIx::Class - all pass With SQL stopped and Test::DBIx::Class: t/Patron.t (Wstat: 65280 Tests: 2 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 11 tests but ran 2. t/SuggestionEngine_AuthorityFile.t (Wstat: 256 Tests: 4 Failed: 1) Failed test: 4 Non-zero exit status: 1 Parse errors: Bad plan. You planned 46 tests but ran 4. t/XSLT.t (Wstat: 65280 Tests: 8 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 9 tests but ran 8. With SQL started and no Test::DBIx::Class - all pass With SQL started and Test::DBIx::Class: t/SuggestionEngine_AuthorityFile.t (Wstat: 256 Tests: 4 Failed: 1) Failed test: 4 Non-zero exit status: 1 Parse errors: Bad plan. You planned 46 tests but ran 4.
Created attachment 65368 [details] [review] Bug 18851: Fix few other tests
Created attachment 65574 [details] [review] Bug 18851: Database handler must not be created at runtime Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 65575 [details] [review] Bug 18851: Test::DBIx::Class is not needed in 00-load.t Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 65576 [details] [review] Bug 18851: Tests must be skipped in cardnumber.t if Test::DBIx::Class is not installed Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 65577 [details] [review] Bug 18851: Make OverDrive.T pass if dbms is not running Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 65578 [details] [review] Bug 18851: Fix few other tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 65579 [details] [review] Bug 18851: (QA followup) Test doesn't need sessions on DB As the DB structure is not initialized for sessions, running this tests raise an irrelevant warning. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
I successfully ran all the tests: - With and without a DB server running - With and without Test::DBIx::Class installed Added a tiny followup to avoid irrelevant warnings.
Pushed to master for 17.11, thanks to everybody involved!
I have a lot of conflicts during rebase on 17.05.x and I'm not sure my test env is well configured to mock DB.
Fridolin: I suppose you missed that it depends on bug 18226. I could easily apply both to 17.05.x, there is just one test to 'git add'. This would probably fix the failing t/XSLT.t in 17.05.x (with Test::DBiX::Class but without DB, as on the nightly server). Would you reconsider pushing to 17.05.x?
Nevermind, it fails a lot more tests afterwards. There is more missing.
Ok, it is, in this order, 18285 18286 18287 18288 18289 18226 18851 No rebase needed. All tests run fine afterwards (not checked db-dependent)
17.05.x end of life is in septembre so I will keep as it is