Bugzilla – Attachment 74120 Details for
Bug 20576
t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t fails if Elasticsearch is configured but not running
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20576: Skip without dying horribly
Bug-20576-Skip-without-dying-horribly.patch (text/plain), 2.18 KB, created by
Mark Tompsett
on 2018-04-13 02:12:53 UTC
(
hide
)
Description:
Bug 20576: Skip without dying horribly
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-04-13 02:12:53 UTC
Size:
2.18 KB
patch
obsolete
>From c50047ea20a5c1f9c2bfcbadecbccf4caa118469 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 13 Apr 2018 01:55:25 +0000 >Subject: [PATCH] Bug 20576: Skip without dying horribly > >TEST PLAN >--------- >no elasticsearch section in koha-conf.xml >prove t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >-- nasty >elasticsearch, but no nodes >prove t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >-- ugly >apply patch >re-run above cases >-- unique skips >run qa test tools >--- > .../Koha_SearchEngine_Elasticsearch_Search.t | 31 +++++++++++++++++++--- > 1 file changed, 27 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >index 5085690..efed699 100644 >--- a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >+++ b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >@@ -1,3 +1,5 @@ >+#!/usr/bin/perl >+ > # Copyright 2015 Catalyst IT > # > # This file is part of Koha. >@@ -18,7 +20,10 @@ > use Modern::Perl; > > use Test::More tests => 13; >+use C4::Context; > use t::lib::Mocks; >+use English qw( -no_match_vars ); >+use constant NUM_TESTS_CONFIG_DEPENDENT => 6; > > use Koha::SearchEngine::Elasticsearch::QueryBuilder; > >@@ -39,10 +44,28 @@ ok( my $query = $builder->build_query('easy'), 'Build a search query'); > > SKIP: { > >- eval { $builder->get_elasticsearch_params; }; >- >- skip 'ElasticSeatch configuration not available', 6 >- if $@; >+ my $check; >+ my $msg; >+ if ( !defined C4::Context->config('elasticsearch') ) { >+ $msg = 'ElasticSearch configuration not available'; >+ } >+ if ( !$msg ) { >+ my $ses = Search::Elasticsearch->new( >+ { 'nodes' => ['localhost:9200'], 'index' => 'mydb' } ); >+ $check = eval { my $node_check = $ses->nodes->info; }; >+ $msg = $EVAL_ERROR; >+ } >+ >+ if ( !$check && !$msg ) { >+ $msg = 'Unable to check ElasticSearch node info'; >+ } >+ elsif ( $msg =~ /NoNode/xsm ) { >+ $msg = 'ElasticSearch lacks nodes'; >+ } >+ >+ if ($msg) { >+ skip $msg, NUM_TESTS_CONFIG_DEPENDENT; >+ } > > ok( my $results = $searcher->search( $query) , 'Do a search ' ); > >-- >2.1.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 20576
:
74120
|
90865