Bugzilla – Attachment 74118 Details for
Bug 18738
Koha_Elasticsearch_Indexer.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 18738: Improve failure cases to skip better
Bug-18738-Improve-failure-cases-to-skip-better.patch (text/plain), 2.01 KB, created by
Mark Tompsett
on 2018-04-12 19:38:53 UTC
(
hide
)
Description:
Bug 18738: Improve failure cases to skip better
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-04-12 19:38:53 UTC
Size:
2.01 KB
patch
obsolete
>From f2c05354ef67aadf744defe08f4ba96caf6c2b10 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Thu, 12 Apr 2018 19:36:29 +0000 >Subject: [PATCH] Bug 18738: Improve failure cases to skip better > >TEST PLAN >--------- >no elasticsearch section in koha-conf.xml >prove t/db_dependent/Koha_Elasticsearch_Indexer.t >-- nasty >elasticsearch, but no nodes >prove t/db_dependent/Koha_Elasticsearch_Indexer.t >-- ugly >apply patch >re-run above cases >-- unique skips >run qa test tools >--- > t/db_dependent/Koha_Elasticsearch_Indexer.t | 31 ++++++++++++++++++++++++----- > 1 file changed, 26 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Koha_Elasticsearch_Indexer.t b/t/db_dependent/Koha_Elasticsearch_Indexer.t >index 7ad9e21..3a9f4fe 100644 >--- a/t/db_dependent/Koha_Elasticsearch_Indexer.t >+++ b/t/db_dependent/Koha_Elasticsearch_Indexer.t >@@ -1,3 +1,5 @@ >+#!/usr/bin/perl >+ > # Copyright 2015 Catalyst IT > # > # This file is part of Koha. >@@ -19,6 +21,8 @@ use Modern::Perl; > > use Test::More tests => 6; > use Test::MockModule; >+use Try::Tiny; >+use English qw( -no_match_vars ); > use t::lib::Mocks; > > use MARC::Record; >@@ -49,11 +53,28 @@ ok( my $converted = $indexer->_convert_marc_to_json($records), > is( $converted->count, 1, 'One converted record' ); > > SKIP: { >- >- eval { $indexer->get_elasticsearch_params; }; >- >- skip 'ElasticSeatch configuration not available', 1 >- if $@; >+ my $check; >+ my $msg; >+ try { >+ my $ses = Search::Elasticsearch->new( >+ $indexer->get_elasticsearch_params ); >+ $check = eval { >+ my $node_check = $ses->nodes->info; >+ }; >+ $msg = $EVAL_ERROR; >+ } catch { >+ $msg = 'ElasticSearch configuration not available'; >+ }; >+ >+ if (! $check && ! $msg) { >+ $msg = 'Unable to check ElasticSearch node info'; >+ } elsif ( $msg =~ /NoNode/xsm ) { >+ $msg = 'ElasticSearch lacks nodes'; >+ } >+ >+ if ($msg) { >+ skip $msg, 1; >+ } > > ok( $indexer->update_index(undef,$records), 'Update Index' ); > } >-- >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 18738
:
74118
|
74121