Bug 41710

Summary: SearchEngine/Elasticsearch/Search.t does not rollback properly
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Lucas Gass (lukeg) <lucas>
Severity: normal    
Priority: P5 - low CC: lucas
Version: unspecifiedKeywords: RM_priority
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41682
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
26.05.00
Circulation function:
Attachments: Bug 41710: Correctly run tests SearchEngine/Elasticsearch/Search.t in a txn
Bug 41710: Correctly run tests SearchEngine/Elasticsearch/Search.t in a txn
Bug 41710: Correctly run tests SearchEngine/Elasticsearch/Search.t in a txn

Description Jonathan Druart 2026-01-26 10:09:19 UTC
syspref ElasticsearchIndexStatus_mydb is created in DB and persists after the tests finished.
Comment 1 Jonathan Druart 2026-01-26 10:14:15 UTC
Created attachment 192013 [details] [review]
Bug 41710: Correctly run tests SearchEngine/Elasticsearch/Search.t in a txn

Test plan:
0. Apply this patch and startup ktd with elastic (e.g `--search-engine es7`)
1. prove t/db_dependent/check_sysprefs.t
=> pass
2. DB cli> SELECT COUNT(*) FROM systempreferences;
3. prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
4. DB cli> SELECT COUNT(*) FROM systempreferences;
=> No change, still the same number of sysprefs
5. prove t/db_dependent/check_sysprefs.t
=> pass
6. Revert this patch or checkout main
7. prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
8. DB cli> SELECT COUNT(*) FROM systempreferences;
=> One syspref crated (ElasticsearchIndexStatus_mydb)
9. prove t/db_dependent/check_sysprefs.t
=> fail
Comment 2 David Nind 2026-01-26 19:49:51 UTC
Created attachment 192061 [details] [review]
Bug 41710: Correctly run tests SearchEngine/Elasticsearch/Search.t in a txn

Test plan:
0. Apply this patch and startup ktd with elastic (e.g `--search-engine es7`)
1. prove t/db_dependent/check_sysprefs.t
=> pass
2. DB cli> SELECT COUNT(*) FROM systempreferences;
3. prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
4. DB cli> SELECT COUNT(*) FROM systempreferences;
=> No change, still the same number of sysprefs
5. prove t/db_dependent/check_sysprefs.t
=> pass
6. Revert this patch or checkout main
7. prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
8. DB cli> SELECT COUNT(*) FROM systempreferences;
=> One syspref crated (ElasticsearchIndexStatus_mydb)
9. prove t/db_dependent/check_sysprefs.t
=> fail

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Lucas Gass (lukeg) 2026-01-26 21:26:44 UTC
Created attachment 192065 [details] [review]
Bug 41710: Correctly run tests SearchEngine/Elasticsearch/Search.t in a txn

Test plan:
0. Apply this patch and startup ktd with elastic (e.g `--search-engine es7`)
1. prove t/db_dependent/check_sysprefs.t
=> pass
2. DB cli> SELECT COUNT(*) FROM systempreferences;
3. prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
4. DB cli> SELECT COUNT(*) FROM systempreferences;
=> No change, still the same number of sysprefs
5. prove t/db_dependent/check_sysprefs.t
=> pass
6. Revert this patch or checkout main
7. prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
8. DB cli> SELECT COUNT(*) FROM systempreferences;
=> One syspref crated (ElasticsearchIndexStatus_mydb)
9. prove t/db_dependent/check_sysprefs.t
=> fail

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Lucas Gass (lukeg) 2026-01-26 21:38:48 UTC
Nice work everyone!

Pushed to main for 26.05