@@ -, +, @@ --- t/db_dependent/Koha/SearchEngine/ElasticSearch.t | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) --- a/t/db_dependent/Koha/SearchEngine/ElasticSearch.t +++ a/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'); @@ -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; --