Bugzilla – Attachment 65392 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 - (follow-up) Cleanup after tests
Bug-17897---follow-up-Cleanup-after-tests.patch (text/plain), 3.18 KB, created by
Lari Taskula
on 2017-08-01 12:28:56 UTC
(
hide
)
Description:
Bug 17897 - (follow-up) Cleanup after tests
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2017-08-01 12:28:56 UTC
Size:
3.18 KB
patch
obsolete
>From 0283a18b8ce122d718ecc8ad39521f23ef08e2bb Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@jns.fi> >Date: Tue, 1 Aug 2017 15:26:20 +0300 >Subject: [PATCH] Bug 17897 - (follow-up) Cleanup after tests > >Adds rollback to test data in t/db_dependent/Koha/SearchEngine/ElasticSearch.t > >To test: >1. prove t/db_dependent/Koha/SearchEngine/ElasticSearch.t >--- > t/db_dependent/Koha/SearchEngine/ElasticSearch.t | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/SearchEngine/ElasticSearch.t b/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >index 77d2f72..54635e3 100644 >--- a/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >+++ b/t/db_dependent/Koha/SearchEngine/ElasticSearch.t >@@ -21,14 +21,18 @@ use Modern::Perl qw(2014); > use utf8; > use Test::More; > >+use Koha::Database; > use Koha::SearchEngine::Elasticsearch; > use Koha::SearchMappingManager; > >+my $schema = Koha::Database->schema; > > 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 > $rv = Koha::SearchMappingManager::flush(); >@@ -69,12 +73,16 @@ sub reset_elasticsearch_mappings { > $mappings = Koha::SearchMappingManager::get_search_mappings({index_name => 'biblios'}); > $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'); >@@ -90,13 +98,17 @@ sub get_search_mappings { > ok(1, 'Scenario: Get all search mappings'); > $mappings = Koha::SearchMappingManager::get_search_mappings({index_name => 'biblios'}); > ok($mappings, 'When search mappings are fetched'); >- ok($mappings->count() > 10, 'Then we have "'.$mappings->count().'" search mappings :)') >+ 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', >@@ -121,6 +133,8 @@ sub add_mapping { > $mappings = Koha::SearchMappingManager::get_search_mappings({index_name => 'biblios', name => 'ln-test'}); > $count = $mappings->count(); > is($count, 1, "Then we received only one mapping from the database"); >+ >+ $schema->storage->txn_rollback; > } > > done_testing; >-- >2.7.4
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