Bug 19985

Summary: TestBuilder.t fails if default circ rule exists
Product: Koha Reporter: Nick Clemens <nick>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, m.de.rooy
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 19985: Make TestBuilder.t pass even if default_circ_rules is not empty
Bug 19985: Make TestBuilder.t pass even if default_circ_rules is not empty

Description Nick Clemens 2018-01-16 18:35:18 UTC
Set a default circ rule

vagrant@kohadevbox:kohaclone(BUGFUN)$ prove t/db_dependent/TestBuilder.t
t/db_dependent/TestBuilder.t .. 1/13 Violation of unique constraint in DefaultCircRule at /home/vagrant/kohaclone/t/lib/TestBuilder.pm line 241.

    #   Failed test 'TestBuilder should be able to create an object for every source'
    #   at t/db_dependent/TestBuilder.t line 78.
    #          got: '1'
    #     expected: '0'
    # The following sources have not been generated correctly: DefaultCircRule
    # Looks like you failed 1 test of 1.
t/db_dependent/TestBuilder.t .. 3/13 
#   Failed test 'Build all sources'
#   at t/db_dependent/TestBuilder.t line 84.
t/db_dependent/TestBuilder.t .. 12/13 # Looks like you failed 1 test of 13.
t/db_dependent/TestBuilder.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/13 subtests
Comment 1 Jonathan Druart 2018-01-22 20:21:51 UTC
Created attachment 70812 [details] [review]
Bug 19985: Make TestBuilder.t pass even if default_circ_rules is not empty

This table cannot contain more than 1 row, so we need to remove its data
before trying to generate a new entry.

Test plan:
Set a default circ rule
 prove t/db_dependent/TestBuilder.t
should return green

Without this patch you get:
    #   Failed test 'TestBuilder should be able to create an object for every source'
    #   at t/db_dependent/TestBuilder.t line 78.
    #          got: '1'
    #     expected: '0'
    # The following sources have not been generated correctly: DefaultCircRule
    # Looks like you failed 1 test of 1.
Comment 2 Mark Tompsett 2018-01-23 02:37:31 UTC
Created attachment 70817 [details] [review]
Bug 19985: Make TestBuilder.t pass even if default_circ_rules is not empty

This table cannot contain more than 1 row, so we need to remove its data
before trying to generate a new entry.

Test plan:
Set a default circ rule
 prove t/db_dependent/TestBuilder.t
should return green

Without this patch you get:
    #   Failed test 'TestBuilder should be able to create an object for every source'
    #   at t/db_dependent/TestBuilder.t line 78.
    #          got: '1'
    #     expected: '0'
    # The following sources have not been generated correctly: DefaultCircRule
    # Looks like you failed 1 test of 1.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 3 Jonathan Druart 2018-01-23 19:07:46 UTC
Trivial, skipping QA.
Comment 4 Marcel de Rooy 2018-01-26 06:47:31 UTC
(In reply to Jonathan Druart from comment #3)
> Trivial, skipping QA.

Please adjust status if you do so. This has been pushed while still in the signoff queue. Thanks.
Comment 5 Nick Clemens 2018-02-02 17:02:52 UTC
Awesome work all! Pushed to stable for 17.11.03
Comment 6 Fridolin Somers 2018-02-08 09:52:37 UTC
Pushed to 17.05.x for v17.05.09