Bug 30135 might have introduced a flaw in the tests - when we try to install Koha 22.05.02 and run t/ediorder.t, it fails with this output: vagrant@kohadevbox:kohaclone((v22.05.02))$ sudo koha-shell kohadev kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/Ediorder.t t/Ediorder.t .. 1/13 Use of uninitialized value $lsq_field in hash element at /home/vagrant/kohaclone/Koha/Edifact/Order.pm line 563. Use of uninitialized value $lsq_field in hash element at /home/vagrant/kohaclone/Koha/Edifact/Order.pm line 563. t/Ediorder.t .. 11/13 # Failed test 'Single Gir field OK' # at t/Ediorder.t line 104. # got: 'GIR+001+BUDGET:LFN+BRANCH:LLO+TYPE:LST+CALL:LSM' # expected: 'GIR+001+BUDGET:LFN+BRANCH:LLO+TYPE:LST+LOCATION:LSQ+CALL:LSM' Use of uninitialized value $lsq_field in hash element at /home/vagrant/kohaclone/Koha/Edifact/Order.pm line 563. Use of uninitialized value $lsq_field in hash element at /home/vagrant/kohaclone/Koha/Edifact/Order.pm line 563. $VAR1 = 'GIR+001+BUDGET:LFN+BRANCH:LLO+TYPE:LST+CALL:LSM+S_I:LVT'; $VAR2 = 'GIR+002+BUDGET:LFN+BRANCH:LLO+TYPE:LST+CALL:LSM+S_I:LVT'; Use of uninitialized value $got in string eq at (eval in cmp_ok) t/Ediorder.t line 119. # Failed test 'First part of split Gir field OK' # at t/Ediorder.t line 119. # got: undef # expected: 'GIR+002+BUDGET:LFN+BRANCH:LLO+TYPE:LST+LOCATION:LSQ+CALL:LSM' Use of uninitialized value $got in string eq at (eval in cmp_ok) t/Ediorder.t line 125. # Failed test 'Second part of split GIR field OK' # at t/Ediorder.t line 125. # got: undef # expected: 'GIR+002+S_I:LVT' # Looks like you failed 3 tests of 13. t/Ediorder.t .. Dubious, test returned 3 (wstat 768, 0x300) Failed 3/13 subtests Test Summary Report ------------------- t/Ediorder.t (Wstat: 768 Tests: 13 Failed: 3) Failed tests: 11-13 Non-zero exit status: 3 Files=1, Tests=13, 2 wallclock secs ( 0.02 usr 0.00 sys + 1.40 cusr 0.10 csys = 1.52 CPU) Result: FAIL
% git checkout v22.05.02) % reset_all % prove t/Ediorder.t All tests successful. Works for me. And Jenkins is happy as well.
Ok If I checkout the branch it fails Failed test 'Single Gir field OK' # at t/Ediorder.t line 104. # got: 'GIR+001+BUDGET:LFN+BRANCH:LLO+TYPE:LST+CALL:LSM' # expected: 'GIR+001+BUDGET:LFN+BRANCH:LLO+TYPE:LST+LOCATION:LSQ+CALL:LSM' Use of uninitialized value $lsq_field in hash element at /home/vagrant/kohaclone/Koha/Edifact/Order.pm line 563. Use of uninitialized value $lsq_field in hash element at /home/vagrant/kohaclone/Koha/Edifact/Order.pm line 563. Use of uninitialized value $got in string eq at (eval in cmp_ok) t/Ediorder.t line 117. # Failed test 'First part of split Gir field OK' # at t/Ediorder.t line 117. # got: undef # expected: 'GIR+002+BUDGET:LFN+BRANCH:LLO+TYPE:LST+LOCATION:LSQ+CALL:LSM' Use of uninitialized value $got in string eq at (eval in cmp_ok) t/Ediorder.t line 123. # Failed test 'Second part of split GIR field OK' # at t/Ediorder.t line 123. # got: undef # expected: 'GIR+002+S_I:LVT' # Looks like you failed 3 tests of 13. This is because this test is now db_dependent Koha/Edifact/Order.pm: my $lsq_field = C4::Context->preference('EdifactLSQ'); So it needs to probably be moved out of t, or that syspref needs to be mocked. The reason it works is if that syspref is set location. If I set the syspref to collection, the tests fail, if i set it location the tests pass. The problem is then when you are building a package you dont have a database, the t/ tests should all pass without relying on a syspref fetched from a db. Chris
Martin, can you have a look at this?
Created attachment 137710 [details] [review] Bug 31134: Mock EdifactLSQ for t/Edifact.t This patch adds a mock for the EdifactLSQ preference so we can consistently pass when a database is not available.
Thanks for drawing my attention to this one.. should work with the patch attached :)
Created attachment 137711 [details] [review] Bug 31134: Mock EdifactLSQ for t/Edifact.t This patch adds a mock for the EdifactLSQ preference so we can consistently pass when a database is not available. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 137714 [details] [review] Bug 31134: Mock EdifactLSQ for t/Edifact.t This patch adds a mock for the EdifactLSQ preference so we can consistently pass when a database is not available. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for 22.11. Nice work everyone, thanks!
Backported to 22.05.x for 22.05.05
depends on 30135 not released in 21.11.x. won't backport.