View | Details | Raw Unified | Return to bug 20576
Collapse All | Expand All

(-)a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t (-5 / +27 lines)
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 18-24 Link Here
18
use Modern::Perl;
20
use Modern::Perl;
19
21
20
use Test::More tests => 13;
22
use Test::More tests => 13;
23
use C4::Context;
21
use t::lib::Mocks;
24
use t::lib::Mocks;
25
use English qw( -no_match_vars );
26
use constant NUM_TESTS_CONFIG_DEPENDENT => 6;
22
27
23
use Koha::SearchEngine::Elasticsearch::QueryBuilder;
28
use Koha::SearchEngine::Elasticsearch::QueryBuilder;
24
29
Lines 39-48 ok( my $query = $builder->build_query('easy'), 'Build a search query'); Link Here
39
44
40
SKIP: {
45
SKIP: {
41
46
42
    eval { $builder->get_elasticsearch_params; };
47
    my $check;
43
48
    my $msg;
44
    skip 'ElasticSeatch configuration not available', 6
49
    if ( !defined C4::Context->config('elasticsearch') ) {
45
        if $@;
50
        $msg = 'ElasticSearch configuration not available';
51
    }
52
    if ( !$msg ) {
53
        my $ses = Search::Elasticsearch->new(
54
            { 'nodes' => ['localhost:9200'], 'index' => 'mydb' } );
55
        $check = eval { my $node_check = $ses->nodes->info; };
56
        $msg = $EVAL_ERROR;
57
    }
58
59
    if ( !$check && !$msg ) {
60
        $msg = 'Unable to check ElasticSearch node info';
61
    }
62
    elsif ( $msg =~ /NoNode/xsm ) {
63
        $msg = 'ElasticSearch lacks nodes';
64
    }
65
66
    if ($msg) {
67
        skip $msg, NUM_TESTS_CONFIG_DEPENDENT;
68
    }
46
69
47
    ok( my $results = $searcher->search( $query) , 'Do a search ' );
70
    ok( my $results = $searcher->search( $query) , 'Do a search ' );
48
71
49
- 

Return to bug 20576