Bug 28509

Summary: Koha/Acquisition/Orders.t is failing randomly
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, kyle, m.de.rooy
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:
21.11.00,21.05.03
Bug Depends on: 25670    
Bug Blocks: 25551    
Attachments: Bug 28509: Prevent Koha/Acquisition/Orders.t to fail randomly
Bug 28509: Prevent Koha/Acquisition/Orders.t to fail randomly

Description Jonathan Druart 2021-06-03 07:52:21 UTC
03:25:39 koha_1       |     #   Failed test 'The 2 orders are returned'
03:25:39 koha_1       |     #   at t/db_dependent/Koha/Acquisition/Orders.t line 152.
03:25:39 koha_1       |     #     Structures begin differing at:
03:25:39 koha_1       |     #          $got->[0] = '10'
03:25:39 koha_1       |     #     $expected->[0] = '9'
03:25:39 koha_1       |     # Looks like you failed 1 test of 4.
03:25:39 koha_1       | 
03:25:39 koha_1       | #   Failed test 'filter_by_id_including_transfers() tests'
03:25:39 koha_1       | #   at t/db_dependent/Koha/Acquisition/Orders.t line 160.
03:25:39 koha_1       | # Looks like you failed 1 test of 2.
03:25:39 koha_1       | [01:24:50] t/db_dependent/Koha/Acquisition/Orders.t

Koha_21.05_D10 run 6 on Docker_5
Comment 1 Jonathan Druart 2021-06-17 14:49:35 UTC
Master_D9_MDB_Latest/612
Comment 2 Jonathan Druart 2021-07-19 12:24:20 UTC
Koha_21.05_D9/26 D5
Comment 3 Jonathan Druart 2021-07-19 12:25:04 UTC
(In reply to Jonathan Druart from comment #1)
> Master_D9_MDB_Latest/612

This was on Docker_2.
Comment 4 Jonathan Druart 2021-07-19 12:27:01 UTC
(In reply to Jonathan Druart from comment #3)
> (In reply to Jonathan Druart from comment #1)
> > Master_D9_MDB_Latest/612
> 
> This was on Docker_2.

16:36:15 koha_1       |     #   Failed test 'The 2 orders are returned'
16:36:15 koha_1       |     #   at t/db_dependent/Koha/Acquisition/Orders.t line 152.
16:36:15 koha_1       |     #     Structures begin differing at:
16:36:15 koha_1       |     #          $got->[0] = '100'
16:36:15 koha_1       |     #     $expected->[0] = '99'
16:36:15 koha_1       |     # Looks like you failed 1 test of 4.
16:36:15 koha_1       | 
16:36:15 koha_1       | #   Failed test 'filter_by_id_including_transfers() tests'
16:36:15 koha_1       | #   at t/db_dependent/Koha/Acquisition/Orders.t line 160.
Comment 5 Jonathan Druart 2021-07-19 12:27:53 UTC
(In reply to Jonathan Druart from comment #2)
> Koha_21.05_D9/26 D5

16:51:24 koha_1       |     #   Failed test 'The 2 orders are returned'
16:51:24 koha_1       |     #   at t/db_dependent/Koha/Acquisition/Orders.t line 152.
16:51:24 koha_1       |     #     Structures begin differing at:
16:51:24 koha_1       |     #          $got->[0] = '10'
16:51:24 koha_1       |     #     $expected->[0] = '9'
16:51:24 koha_1       |     # Looks like you failed 1 test of 4.
16:51:24 koha_1       | 
16:51:24 koha_1       | #   Failed test 'filter_by_id_including_transfers() tests'
Comment 6 Jonathan Druart 2021-07-19 12:40:01 UTC
Created attachment 122942 [details] [review]
Bug 28509: Prevent Koha/Acquisition/Orders.t to fail randomly

The random errors were:
03:25:39 koha_1       |     #     Structures begin differing at:
03:25:39 koha_1       |     #          $got->[0] = '10'
03:25:39 koha_1       |     #     $expected->[0] = '9'

and

16:36:15 koha_1       |     #     Structures begin differing at:
16:36:15 koha_1       |     #          $got->[0] = '100'
16:36:15 koha_1       |     #     $expected->[0] = '99'

You see it coming?

We sorted the ordernumbers alphabetically.

Test plan:
0. Don't apply this patch
1. % git checkout v21.05.01 # The error is not appearing in master right now
2. Add 2 warn statements before the 'The 2 orders are returned' tests to
display $order_1->ordernumber and $order_2->ordernumber
3. MariaDB CLI > ALTER TABLE aqorders AUTO_INCREMENT=3;
4. prove t/db_dependent/Koha/Acquisition/Orders.t
=> Fail with
    #     Structures begin differing at:
    #          $got->[0] = '10'
    #     $expected->[0] = '9'
5. Apply this patch, repeat 3. and 4.
=> The test passes now.
Comment 7 Marcel de Rooy 2021-07-30 09:32:47 UTC
Created attachment 123293 [details] [review]
Bug 28509: Prevent Koha/Acquisition/Orders.t to fail randomly

The random errors were:
03:25:39 koha_1       |     #     Structures begin differing at:
03:25:39 koha_1       |     #          $got->[0] = '10'
03:25:39 koha_1       |     #     $expected->[0] = '9'

and

16:36:15 koha_1       |     #     Structures begin differing at:
16:36:15 koha_1       |     #          $got->[0] = '100'
16:36:15 koha_1       |     #     $expected->[0] = '99'

You see it coming?

We sorted the ordernumbers alphabetically.

Test plan:
0. Don't apply this patch
1. % git checkout v21.05.01 # The error is not appearing in master right now
2. Add 2 warn statements before the 'The 2 orders are returned' tests to
display $order_1->ordernumber and $order_2->ordernumber
3. MariaDB CLI > ALTER TABLE aqorders AUTO_INCREMENT=3;
4. prove t/db_dependent/Koha/Acquisition/Orders.t
=> Fail with
    #     Structures begin differing at:
    #          $got->[0] = '10'
    #     $expected->[0] = '9'
5. Apply this patch, repeat 3. and 4.
=> The test passes now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Jonathan Druart 2021-07-30 14:02:25 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 9 Kyle M Hall 2021-08-06 11:59:05 UTC
Pushed to 21.05.x for 21.05.03
Comment 10 Fridolin Somers 2021-08-11 19:15:24 UTC
Depends on Bug 25670 not in 20.11.x