Bug 18759 - Circulation.t is failing randomly
Summary: Circulation.t is failing randomly
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Jonathan Druart
QA Contact: Galen Charlton
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 19009
  Show dependency treegraph
 
Reported: 2017-06-08 14:50 UTC by Jonathan Druart
Modified: 2017-07-31 14:31 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 18759: Try to fix random failure from Circulation.t (3.37 KB, patch)
2017-06-08 14:56 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 18759: Try to fix random failure from Circulation.t (3.58 KB, patch)
2017-06-08 15:06 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 18759: (follow-up) Try to fix random failure from Circulation.t (893 bytes, patch)
2017-06-09 13:10 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Jonathan Druart 2017-06-08 14:56:49 UTC
Created attachment 64105 [details] [review]
Bug 18759: Try to fix random failure from Circulation.t

Circulation.t is failing randomly on our CI
https://jenkins.koha-community.org/job/Koha_Master_D8/192/console

    #   Failed test at t/db_dependent/Circulation.t line 1147.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1152.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1156.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1170.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1184.
    #          got: '1'
    #     expected: '0'
    # Looks like you failed 5 tests of 23.

Sometimes one of the alert or impossible flags is set.
This patch guesses that it's because of the 'restricted' value of the item that is evaluated to 1.
If it is not fixed by this patch, we will have more info next time (at least know
if alert or impossible is set).
Comment 2 Tomás Cohen Arazi 2017-06-08 15:06:29 UTC
Created attachment 64107 [details] [review]
Bug 18759: Try to fix random failure from Circulation.t

Circulation.t is failing randomly on our CI
https://jenkins.koha-community.org/job/Koha_Master_D8/192/console

    #   Failed test at t/db_dependent/Circulation.t line 1147.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1152.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1156.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1170.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1184.
    #          got: '1'
    #     expected: '0'
    # Looks like you failed 5 tests of 23.

Sometimes one of the alert or impossible flags is set.
This patch guesses that it's because of the 'restricted' value of the item that is evaluated to 1.
If it is not fixed by this patch, we will have more info next time (at least know
if alert or impossible is set).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
The fix is trivial. Using random data will lead to this situations. The good thing is that
it lets us spot places in which tests need more fine-grained data.
Comment 3 Jonathan Druart 2017-06-08 15:15:36 UTC
Skipping QA, I would like to know quickly if it makes jenkins happy.
Comment 4 Jonathan Druart 2017-06-08 15:15:45 UTC
Patch pushed to master, thanks Tomas!
Comment 5 Marcel de Rooy 2017-06-08 15:39:08 UTC
Without and with this patch:

t/db_dependent/Circulation.t (Wstat: 768 Tests: 95 Failed: 3)
  Failed tests:  90, 92, 94
Comment 6 Jonathan Druart 2017-06-08 15:58:49 UTC
(In reply to Marcel de Rooy from comment #5)
> Without and with this patch:
> 
> t/db_dependent/Circulation.t (Wstat: 768 Tests: 95 Failed: 3)
>   Failed tests:  90, 92, 94

Ha! How do you recreate?
Could you dump the %alerts and %impossible to know which keys are set?
Comment 7 Marcel de Rooy 2017-06-09 12:41:46 UTC
From test 90:
print "L1148:".Dumper($error,$alerts);
L1148:$VAR1 = {
          'itemhomebranch' => 'KL7Eb',
          'ITEMNOTSAMEBRANCH' => 1
        };
$VAR2 = {};

print 'L1168:'.Dumper($question,$alerts);
L1168:$VAR1 = {
          'BORRNOTSAMEBRANCH' => 'jH5uvNo3ZN'
        };
$VAR2 = {};

L1179 $question $alerts
L1179:$VAR1 = {
          'BORRNOTSAMEBRANCH' => 'HZH'
        };
$VAR2 = {};

3 others similar
# Looks like you failed 6 tests of 26.
Comment 8 Marcel de Rooy 2017-06-09 12:45:27 UTC
Subtest: CanBookBeIssued + Koha::Patron->is_debarred|has_overdues

Dumper($question,$alerts);
L1320:$VAR1 = {
          'BORRNOTSAMEBRANCH' => 'HV6N7TZ',
          'USERBLOCKEDOVERDUE' => 1
        };
$VAR2 = {};

# Looks like you failed 4 tests of 8.
Comment 9 Marcel de Rooy 2017-06-09 12:49:27 UTC
Subtest: CanBookBeIssued + AllowMultipleIssuesOnABiblio

line 1488 error, alerts
$VAR1 = {
          'ITEMNOTSAMEBRANCH' => 1,
          'itemhomebranch' => 'bCP'
        };
$VAR2 = {};

etc.

# Looks like you failed 4 tests of 5.
Comment 10 Jonathan Druart 2017-06-09 13:10:02 UTC
Created attachment 64128 [details] [review]
Bug 18759: (follow-up) Try to fix random failure from Circulation.t

If IndependentBranches, CanBookBeRenewed will set ITEMNOTSAMEBRANCH
or BORRNOTSAMEBRANCH flags, if the branches do not match.
Comment 11 Jonathan Druart 2017-06-09 13:12:22 UTC
Marcel, your errors look different that ones from Jenkins.
Yours should be fixed with this patch (I recreated mocking IndependentBranches=1)

Last patch pushed to master!
Comment 12 Fridolin SOMERS 2017-06-12 09:11:42 UTC
Pushed to 17.05.x, will be in 17.05.01
Comment 13 Katrin Fischer 2017-06-13 05:43:32 UTC
This patch has been pushed to 16.11.x and will be in 16.11.09.
Comment 14 Katrin Fischer 2017-06-13 05:44:42 UTC
... patches even.
Comment 15 Marcel de Rooy 2017-06-13 14:24:51 UTC
(In reply to Jonathan Druart from comment #11)
> Marcel, your errors look different that ones from Jenkins.
> Yours should be fixed with this patch (I recreated mocking
> IndependentBranches=1)
> 
> Last patch pushed to master!

Yeah. That was enough. Thx
Comment 16 Mason James 2017-07-31 11:18:31 UTC
Pushed to 16.05.x, for 16.05.15 release