Bug 36356

Summary: FrameworkPlugin.t does not rollback properly
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers, lucas
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36277
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.04,23.05.12
Circulation function:
Bug Depends on:    
Bug Blocks: 25515    
Attachments: Bug 36356: Fix rollback from FrameworkPlugin.t

Description Jonathan Druart 2024-03-19 08:16:37 UTC
Long story short: If too many libraries exist in the DB we have some tests failing:

Bug 36277 because of 2 nested loops on the library list
Bug 36355 because we are fetching the library list from the REST API

This is because FrameworkPlugin.t is not rolling back properly, and the output of the tests is telling it:

% prove t/db_dependent/FrameworkPlugin.t                    t/db_dependent/FrameworkPlugin.t .. 5/6 rollback ineffective with AutoCommit enabled at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1651.
t/db_dependent/FrameworkPlugin.t .. ok                                                                    All tests successful.                                                                                     
Files=1, Tests=6, 14 wallclock secs ( 0.03 usr  0.01 sys + 11.17 cusr  2.63 csys = 13.84 CPU)             Result: PASS
Comment 1 Jonathan Druart 2024-03-19 08:20:53 UTC
Created attachment 163379 [details] [review]
Bug 36356: Fix rollback from FrameworkPlugin.t

rollback ineffective with AutoCommit enabled at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1651.

I have not investigated more than that. Reaching this was already the
end of a long road... (see comment 0)

Test plan:
0. Do not apply this patch
1. select count(*) from branches
Note the value
2. Run
  prove t/db_dependent/FrameworkPlugin.t
=> There is a warning
3. Repeat 1.
=> There are too many libraries!
4. Apply the patch, retry 1, 2, 3
=> No warning, no library added by the tests
Comment 2 Jonathan Druart 2024-03-19 08:26:01 UTC
(In reply to Jonathan Druart from comment #0)
> Bug 36355 because we are fetching the library list from the REST API

This is not correct. See there for more info.
Comment 3 Katrin Fischer 2024-03-19 08:38:08 UTC
Change is small, let's do the final test on Jenkins (passing locally).
Comment 4 Katrin Fischer 2024-03-19 09:27:58 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 5 Fridolin Somers 2024-03-21 10:07:15 UTC
Pushed to 23.11.x for 23.11.04
Comment 6 Lucas Gass (lukeg) 2024-05-13 14:36:56 UTC
Backported to 23.05.x for upcoming 23.05.12