From 426f8a4c3daaf1053d2a78b96a823db29d7cee87 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 27 Aug 2020 15:03:07 +0000 Subject: [PATCH] Bug 26309: Unit tests --- t/Koha/SearchEngine/Elasticsearch.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/t/Koha/SearchEngine/Elasticsearch.t b/t/Koha/SearchEngine/Elasticsearch.t index fede84ca34..c4bcc1bc6a 100644 --- a/t/Koha/SearchEngine/Elasticsearch.t +++ b/t/Koha/SearchEngine/Elasticsearch.t @@ -33,7 +33,7 @@ use Koha::SearchEngine::Elasticsearch::Search; subtest '_read_configuration() tests' => sub { - plan tests => 10; + plan tests => 13; my $configuration; t::lib::Mocks::mock_config( 'elasticsearch', undef ); @@ -89,7 +89,17 @@ subtest '_read_configuration() tests' => sub { $configuration = Koha::SearchEngine::Elasticsearch::_read_configuration; is( $configuration->{index_name}, 'index', 'Index configuration parsed correctly' ); + is( $configuration->{cxn_pool}, 'Static', 'cxn_pool configuration set correctly to Static if not specified' ); is_deeply( $configuration->{nodes}, \@servers , 'Server configuration parsed correctly' ); + + t::lib::Mocks::mock_config( 'elasticsearch', { server => \@servers, index_name => 'index', cxn_pool => 'Fluid' } ); + + $configuration = Koha::SearchEngine::Elasticsearch::_read_configuration; + is( $configuration->{cxn_pool}, 'Fluid', 'cxn_pool configuration parsed correctly' ); + + my $params = Koha::SearchEngine::Elasticsearch::get_elasticsearch_params; + is_deeply( $configuration->{nodes}, \@servers , 'get_elasticsearch_params is just a wrapper for _read_configuration' ); + }; subtest 'get_elasticsearch_settings() tests' => sub { -- 2.11.0