Bug 26589

Summary: t/db_dependent/OAI/Sets.t unit test fails due to OAI-PMH:AutoUpdateSets syspref
Product: Koha Reporter: Alex Buckley <alexbuckley>
Component: Test SuiteAssignee: Alex Buckley <alexbuckley>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: aleisha, lucas, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.06, 19.11.12, 19.05.17
Bug Depends on:    
Bug Blocks: 25460    
Attachments: Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled
Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled
Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled

Description Alex Buckley 2020-10-01 04:42:34 UTC
When the  OAI-PMH:AutoUpdateSets syspref is disabled the t/db_dependent/OAI/Sets.t unit tests all pass successfully. 

But when the syspref is enabled then the unit test fail with this error:

t/db_dependent/OAI/Sets.t .. 1/147 C4::OAI::Sets::AddOAISetsBiblios(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry '39-46' for key 'PRIMARY' [for Statement "
        INSERT INTO oai_sets_biblios (set_id, biblionumber)
        VALUES (?,?)
    " with ParamValues: 0='46', 1=39] at t/db_dependent/OAI/Sets.t line 372
# Looks like your test exited with 255 just after 100.
t/db_dependent/OAI/Sets.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 47/147 subtests
Comment 1 Alex Buckley 2020-10-01 23:33:20 UTC
Created attachment 111050 [details] [review]
Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled

Test plan:
1. Check the OAI-PMH:AutoUpdateSets syspref is disabled
2. Run t/db_dependent/OAI/Sets.t tests and confirm tests pass
successfully
3. Enabled the OAI-PMH:AutoUpdateSets syspref
4. Repeat step 2 and confirm the tests fail

5. Apply this patch and restart plack: sudo koha-plack --restart
<instance>
6. Repeat step 2 and confirm the tests now pass
7. Disable the OAI-PMH:AutoUpdateSets syspref and repeat step 2 and
confirm tests still pass

Sponsored-By: Catalyst IT
Comment 2 David Nind 2020-10-02 09:43:30 UTC
Created attachment 111078 [details] [review]
Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled

Test plan:
1. Check the OAI-PMH:AutoUpdateSets syspref is disabled
2. Run t/db_dependent/OAI/Sets.t tests and confirm tests pass
successfully
3. Enabled the OAI-PMH:AutoUpdateSets syspref
4. Repeat step 2 and confirm the tests fail

5. Apply this patch and restart plack: sudo koha-plack --restart
<instance>
6. Repeat step 2 and confirm the tests now pass
7. Disable the OAI-PMH:AutoUpdateSets syspref and repeat step 2 and
confirm tests still pass

Sponsored-By: Catalyst IT

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Katrin Fischer 2020-10-13 11:44:58 UTC
Created attachment 111538 [details] [review]
Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled

Test plan:
1. Check the OAI-PMH:AutoUpdateSets syspref is disabled
2. Run t/db_dependent/OAI/Sets.t tests and confirm tests pass
successfully
3. Enabled the OAI-PMH:AutoUpdateSets syspref
4. Repeat step 2 and confirm the tests fail

5. Apply this patch and restart plack: sudo koha-plack --restart
<instance>
6. Repeat step 2 and confirm the tests now pass
7. Disable the OAI-PMH:AutoUpdateSets syspref and repeat step 2 and
confirm tests still pass

Sponsored-By: Catalyst IT

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Jonathan Druart 2020-10-14 12:55:27 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 5 Lucas Gass 2020-11-10 22:57:35 UTC
backported to 20.05.x for 20.05.06
Comment 6 Aleisha Amohia 2020-11-17 03:55:00 UTC
backported to 19.11.x for 19.11.12
Comment 7 Victor Grousset/tuxayo 2020-11-17 09:41:14 UTC
Backported to 19.05.x branch for 19.05.17