Bugzilla – Attachment 78592 Details for
Bug 19893
Alternative optimized indexing for Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19893: Restore and fix removed tests
Bug-19893-Restore-and-fix-removed-tests.patch (text/plain), 3.26 KB, created by
David Gustafsson
on 2018-09-12 15:23:28 UTC
(
hide
)
Description:
Bug 19893: Restore and fix removed tests
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2018-09-12 15:23:28 UTC
Size:
3.26 KB
patch
obsolete
>From 942f8d6f03e721173ee2ef9c09f1cee79cb88780 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Fri, 7 Sep 2018 15:18:00 +0200 >Subject: [PATCH] Bug 19893: Restore and fix removed tests > >--- > Koha/SearchEngine/Elasticsearch/Indexer.pm | 1 + > t/db_dependent/Koha_Elasticsearch_Indexer.t | 55 ++++++++++++++++++----------- > 2 files changed, 36 insertions(+), 20 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/Indexer.pm b/Koha/SearchEngine/Elasticsearch/Indexer.pm >index 38b3982b48..a6bd323d30 100644 >--- a/Koha/SearchEngine/Elasticsearch/Indexer.pm >+++ b/Koha/SearchEngine/Elasticsearch/Indexer.pm >@@ -243,6 +243,7 @@ sub drop_index { > my $conf = $self->get_elasticsearch_params(); > my $elasticsearch = $self->get_elasticsearch(); > $elasticsearch->indices->delete(index => $conf->{index_name}); >+ $self->index_status_recreate_required(1); > } > } > >diff --git a/t/db_dependent/Koha_Elasticsearch_Indexer.t b/t/db_dependent/Koha_Elasticsearch_Indexer.t >index 235fbb5db0..80bfe79956 100644 >--- a/t/db_dependent/Koha_Elasticsearch_Indexer.t >+++ b/t/db_dependent/Koha_Elasticsearch_Indexer.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 2; > use Test::MockModule; > use t::lib::Mocks; > >@@ -29,26 +29,41 @@ my $schema = Koha::Database->schema(); > > use_ok('Koha::SearchEngine::Elasticsearch::Indexer'); > >-my $indexer; >-ok( >- $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new({ 'index' => 'biblio' }), >- 'Creating new indexer object' >-); >+subtest 'create_index() tests' => sub { >+ plan tests => 4; >+ my $se = Test::MockModule->new( 'Koha::SearchEngine::Elasticsearch' ); >+ $se->mock( 'get_elasticsearch_params', sub { >+ my ($self, $sub ) = @_; >+ my $method = $se->original( 'get_elasticsearch_params' ); >+ my $params = $method->( $self ); >+ $params->{index_name} .= '__test'; >+ return $params; >+ }); > >-my $marc_record = MARC::Record->new(); >-$marc_record->append_fields( >- MARC::Field->new( '001', '1234567' ), >- MARC::Field->new( '020', '', '', 'a' => '1234567890123' ), >- MARC::Field->new( '245', '', '', 'a' => 'Title' ) >-); >-my $records = [$marc_record]; >+ my $indexer; >+ ok( >+ $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new({ 'index' => 'biblios' }), >+ 'Creating a new indexer object' >+ ); > >-SKIP: { >+ is( >+ $indexer->create_index(), >+ Koha::SearchEngine::Elasticsearch::Indexer::INDEX_STATUS_OK(), >+ 'Creating an index' >+ ); > >- eval { $indexer->get_elasticsearch_params; }; >+ my $marc_record = MARC::Record->new(); >+ $marc_record->append_fields( >+ MARC::Field->new('001', '1234567'), >+ MARC::Field->new('020', '', '', 'a' => '1234567890123'), >+ MARC::Field->new('245', '', '', 'a' => 'Title') >+ ); >+ my $records = [$marc_record]; >+ ok($indexer->update_index(undef, $records), 'Update Index'); > >- skip 'Elasticsearch configuration not available', 1 >- if $@; >- >- ok( $indexer->update_index(undef, $records), 'Update Index' ); >-} >+ is( >+ $indexer->drop_index(), >+ Koha::SearchEngine::Elasticsearch::Indexer::INDEX_STATUS_RECREATE_REQUIRED(), >+ 'Dropping the index' >+ ); >+}; >-- >2.11.0
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 19893
:
70199
|
70200
|
70201
|
70202
|
70230
|
70325
|
73153
|
75109
|
75271
|
75272
|
75353
|
75428
|
75455
|
75588
|
75658
|
75660
|
76612
|
76613
|
76614
|
76629
|
78091
|
78092
|
78093
|
78094
|
78524
|
78561
|
78587
|
78588
|
78589
|
78590
|
78591
|
78592
|
78593
|
78594
|
78690
|
78691
|
78692
|
78693
|
78694
|
78695
|
78696
|
80969
|
80970
|
80971
|
80983
|
81014
|
81015
|
81284
|
81822
|
81901
|
81903
|
81955
|
81957
|
81958
|
81959
|
81960
|
81961
|
81962
|
81963
|
81964
|
81965
|
81966
|
82143
|
82144
|
82145
|
82146
|
82147
|
82148
|
82149
|
82150
|
82151
|
82152
|
82256
|
82257
|
82258
|
82259
|
82260
|
82261
|
82262
|
82263
|
82264
|
82265
|
82266
|
82267