|
Lines 1-3
Link Here
|
|
|
1 |
#!/usr/bin/perl |
| 2 |
|
| 1 |
# Copyright 2015 Catalyst IT |
3 |
# Copyright 2015 Catalyst IT |
| 2 |
# |
4 |
# |
| 3 |
# This file is part of Koha. |
5 |
# This file is part of Koha. |
|
Lines 19-24
use Modern::Perl;
Link Here
|
| 19 |
|
21 |
|
| 20 |
use Test::More tests => 6; |
22 |
use Test::More tests => 6; |
| 21 |
use Test::MockModule; |
23 |
use Test::MockModule; |
|
|
24 |
use Try::Tiny; |
| 25 |
use English qw( -no_match_vars ); |
| 22 |
use t::lib::Mocks; |
26 |
use t::lib::Mocks; |
| 23 |
|
27 |
|
| 24 |
use MARC::Record; |
28 |
use MARC::Record; |
|
Lines 49-59
ok( my $converted = $indexer->_convert_marc_to_json($records),
Link Here
|
| 49 |
is( $converted->count, 1, 'One converted record' ); |
53 |
is( $converted->count, 1, 'One converted record' ); |
| 50 |
|
54 |
|
| 51 |
SKIP: { |
55 |
SKIP: { |
| 52 |
|
56 |
my $check; |
| 53 |
eval { $indexer->get_elasticsearch_params; }; |
57 |
my $msg; |
| 54 |
|
58 |
try { |
| 55 |
skip 'ElasticSeatch configuration not available', 1 |
59 |
my $ses = Search::Elasticsearch->new( |
| 56 |
if $@; |
60 |
$indexer->get_elasticsearch_params ); |
|
|
61 |
$check = eval { |
| 62 |
my $node_check = $ses->nodes->info; |
| 63 |
}; |
| 64 |
$msg = $EVAL_ERROR; |
| 65 |
} catch { |
| 66 |
$msg = 'ElasticSearch configuration not available'; |
| 67 |
}; |
| 68 |
|
| 69 |
if (! $check && ! $msg) { |
| 70 |
$msg = 'Unable to check ElasticSearch node info'; |
| 71 |
} elsif ( $msg =~ /NoNode/xsm ) { |
| 72 |
$msg = 'ElasticSearch lacks nodes'; |
| 73 |
} |
| 74 |
|
| 75 |
if ($msg) { |
| 76 |
skip $msg, 1; |
| 77 |
} |
| 57 |
|
78 |
|
| 58 |
ok( $indexer->update_index(undef,$records), 'Update Index' ); |
79 |
ok( $indexer->update_index(undef,$records), 'Update Index' ); |
| 59 |
} |
80 |
} |
| 60 |
- |
|
|