Bugzilla – Attachment 143744 Details for
Bug 17897
Koha::SearchMappingManager - Simplify search mapping modifications
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17897: Fix failing tests
0001-Bug-17897-Fix-failing-tests.patch (text/plain), 3.50 KB, created by
Emmi Takkinen
on 2022-11-11 08:09:09 UTC
(
hide
)
Description:
Bug 17897: Fix failing tests
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2022-11-11 08:09:09 UTC
Size:
3.50 KB
patch
obsolete
>From c5e7cbeefc6852bc478b5f3068e0afb99be40501 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Tue, 19 Jan 2021 11:46:52 +0200 >Subject: [PATCH] Bug 17897: Fix failing tests > >Tests failed when txn_begin and rollback were used inside >of subtests. > >To test prove t/db_dependent/Koha/SearchEngine/ElasticSearch.t >--- > t/db_dependent/Koha/SearchEngine/ElasticSearch.t | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Koha/SearchEngine/ElasticSearch.t b/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >index 77c9237c13..a9d3f12026 100644 >--- a/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >+++ b/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >@@ -26,12 +26,13 @@ use Koha::SearchEngine::Elasticsearch; > use Koha::SearchMappingManager; > > my $schema = Koha::Database->schema; >+$schema->storage->txn_begin; > > subtest "Reset Elasticsearch mappings", \&reset_elasticsearch_mappings; > sub reset_elasticsearch_mappings { > my ($rv, $mappings, $count, $mapping); > >- $schema->storage->txn_begin; >+ > > ok(1, 'Scenario: Reset Elasticsearch mappings to an empty database'); > #There might or might not be any mappings. Whatever the initial status is, make sure we start from empty tables >@@ -74,15 +75,12 @@ sub reset_elasticsearch_mappings { > $count = $mappings->count(); > ok($count > 10, 'Then search mapping tables have been populated'); > >- $schema->storage->txn_rollback; > } > > subtest "Get Elasticsearch mappings", \&get_search_mappings; > sub get_search_mappings { > my ($mappings, $mapping); > >- $schema->storage->txn_begin; >- > ok(1, 'Scenario: Get a single search mapping by name'); > $mappings = Koha::SearchMappingManager::get_search_mappings({index_name => 'biblios', name => 'ff7-00'}); > ok($mappings, 'When a search mappings is fetched'); >@@ -91,7 +89,7 @@ sub get_search_mappings { > is($mapping->get_column('type'), '', 'And the search mapping "type" matches'); > is($mapping->get_column('facet'), '0', 'And the search mapping "facet" matches'); > is($mapping->get_column('suggestible'), '0', 'And the search mapping "suggestible" matches'); >- is($mapping->get_column('sort'), undef, 'And the search mapping "sort" matches'); >+ is($mapping->get_column('sort'), '1', 'And the search mapping "sort" matches'); > is($mapping->get_column('search'), '1', 'And the search mapping "search" matches'); > is($mapping->get_column('marc_type'), 'marc21', 'And the search mapping "marc_type" matches'); > is($mapping->get_column('marc_field'), '007_/0', 'And the search mapping "marc_field" matches'); >@@ -101,15 +99,12 @@ sub get_search_mappings { > ok($mappings, 'When search mappings are fetched'); > ok($mappings->count() > 10, 'Then we have "'.$mappings->count().'" search mappings :)'); > >- $schema->storage->txn_rollback; > } > > subtest "Add a search mapping", \&add_mapping; > sub add_mapping { > my ($rv, $mappings, $mapping, $count); > >- $schema->storage->txn_begin; >- > ok(1, "Scenario: Add the same mapping twice and hope for no duplicate mappings"); > $rv = Koha::SearchMappingManager::add_mapping({name => 'ln-test', > label => 'original language', >@@ -135,7 +130,9 @@ sub add_mapping { > $count = $mappings->count(); > is($count, 1, "Then we received only one mapping from the database"); > >- $schema->storage->txn_rollback; >+ > } > >+$schema->storage->txn_rollback; >+ > done_testing; >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17897
:
58942
|
65392
|
102475
|
102476
|
115320
|
115321
|
115322
|
143744
|
157224
|
157282
|
157283
|
157284
|
158487
|
158488
|
158489
|
158490
|
158491
|
158492
|
158561
|
158562
|
158563
|
158564