From cded299db5571ec15f099877fc60816205e3c751 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Wed, 11 Oct 2017 10:50:18 -0300
Subject: [PATCH] Bug 19441: Remove ES-related tests

16.05.x do not provided stable ES support, it will take us too much time
to keep these tests up-to-date.
---
 t/db_dependent/Koha_Elasticsearch.                 |  23 -----
 t/db_dependent/Koha_Elasticsearch_Indexer.t        |  55 -----------
 .../Koha_SearchEngine_Elasticsearch_Search.t       | 106 ---------------------
 3 files changed, 184 deletions(-)
 delete mode 100644 t/db_dependent/Koha_Elasticsearch.
 delete mode 100644 t/db_dependent/Koha_Elasticsearch_Indexer.t
 delete mode 100644 t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t

diff --git a/t/db_dependent/Koha_Elasticsearch. b/t/db_dependent/Koha_Elasticsearch.
deleted file mode 100644
index bad08d2495..0000000000
--- a/t/db_dependent/Koha_Elasticsearch.
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright 2015 Catalyst IT
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Koha is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Koha; if not, see <http://www.gnu.org/licenses>
-
-use strict;
-use warnings;
-
-use Test::More tests => 1;                      # last test to print
-
-use_ok('Koha::Search::Engine::Elasticsearch');
diff --git a/t/db_dependent/Koha_Elasticsearch_Indexer.t b/t/db_dependent/Koha_Elasticsearch_Indexer.t
deleted file mode 100644
index 04a8e2a69b..0000000000
--- a/t/db_dependent/Koha_Elasticsearch_Indexer.t
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright 2015 Catalyst IT
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Koha is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Koha; if not, see <http://www.gnu.org/licenses>.
-
-use Modern::Perl;
-
-use Test::More tests => 5;
-
-use MARC::Record;
-
-use_ok('Koha::SearchEngine::Elasticsearch::Indexer');
-
-my $indexer;
-ok(
-    $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new({ 'index' => 'biblio' }),
-    'Creating new indexer object'
-);
-
-my $marc_record = MARC::Record->new();
-$marc_record->append_fields(
-    MARC::Field->new( '001', '1234567' ),
-    MARC::Field->new( '020', '', '', 'a' => '1234567890123' ),
-    MARC::Field->new( '245', '', '', 'a' => 'Title' )
-);
-
-my $records = [$marc_record];
-ok( my $converted = $indexer->_convert_marc_to_json($records),
-    'Convert some records' );
-
-is( $converted->count, 1, 'One converted record' );
-
-SKIP: {
-
-    eval { $indexer->get_elasticsearch_params; };
-
-    skip 'ElasticSeatch configuration not available', 1
-        if $@;
-
-    ok( $indexer->update_index(undef,$records), 'Update Index' );
-}
-
-1;
diff --git a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t
deleted file mode 100644
index f83bd8d11c..0000000000
--- a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t
+++ /dev/null
@@ -1,106 +0,0 @@
-# Copyright 2015 Catalyst IT
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Koha is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Koha; if not, see <http://www.gnu.org/licenses>.
-
-use Modern::Perl;
-
-use Test::More tests => 12;
-use t::lib::Mocks;
-
-use Koha::SearchEngine::Elasticsearch::QueryBuilder;
-
-my $builder = Koha::SearchEngine::Elasticsearch::QueryBuilder->new( { index => 'mydb' } );
-
-use_ok('Koha::SearchEngine::Elasticsearch::Search');
-
-ok(
-    my $searcher = Koha::SearchEngine::Elasticsearch::Search->new(
-        { 'nodes' => ['localhost:9200'], 'index' => 'mydb' }
-    ),
-    'Creating a Koha::SearchEngine::Elasticsearch::Search object'
-);
-
-is( $searcher->index, 'mydb', 'Testing basic accessor' );
-
-ok( my $query = $builder->build_query('easy'), 'Build a search query');
-
-SKIP: {
-
-    eval { $builder->get_elasticsearch_params; };
-
-    skip 'ElasticSeatch configuration not available', 6
-        if $@;
-
-    ok( my $results = $searcher->search( $query) , 'Do a search ' );
-
-    ok( my $marc = $searcher->json2marc( $results->first ), 'Convert JSON to MARC');
-
-    is (my $count = $searcher->count( $query ), 0 , 'Get a count of the results, without returning results ');
-
-    ok ($results = $searcher->search_compat( $query ), 'Test search_compat' );
-
-    ok (($results,$count) = $searcher->search_auth_compat ( $query ), 'Test search_auth_compat' );
-
-    is ( $count = $searcher->count_auth_use($searcher,1), 0, 'Testing count_auth_use');
-
-}
-
-subtest 'json2marc' => sub {
-    plan tests => 4;
-    my $leader = '00626nam a2200193   4500';
-    my $_001 = 42;
-    my $_010a = '123456789';
-    my $_010d = 145;
-    my $_200a = 'a title';
-    my $json = [ # It's not a JSON, see the POD of json2marc
-        [ 'LDR', undef, undef, '_', $leader ],
-        [ '001', undef, undef, '_', $_001 ],
-        [ '010', ' ', ' ', 'a', $_010a, 'd', $_010d ],
-        [ '200', '1', ' ', 'a', $_200a, ], # Yes UNIMARC but we don't mind here
-    ];
-
-    my $marc = $searcher->json2marc( $json );
-    is( $marc->leader, $leader, );
-    is( $marc->field('001')->data, $_001, );
-    is( $marc->subfield('010', 'a'), $_010a, );
-    is( $marc->subfield('200', 'a'), $_200a, );
-
-};
-
-subtest 'build_query tests' => sub {
-    plan tests => 6;
-
-    t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
-    my $query = $builder->build_query();
-    ok( defined $query->{aggregations}{homebranch},
-        'homebranch added to facets if DisplayLibraryFacets=both' );
-    ok( defined $query->{aggregations}{holdingbranch},
-        'holdingbranch added to facets if DisplayLibraryFacets=both' );
-    t::lib::Mocks::mock_preference('DisplayLibraryFacets','holding');
-    $query = $builder->build_query();
-    ok( !defined $query->{aggregations}{homebranch},
-        'homebranch not added to facets if DisplayLibraryFacets=holding' );
-    ok( defined $query->{aggregations}{holdingbranch},
-        'holdingbranch added to facets if DisplayLibraryFacets=holding' );
-    t::lib::Mocks::mock_preference('DisplayLibraryFacets','home');
-    $query = $builder->build_query();
-    ok( defined $query->{aggregations}{homebranch},
-        'homebranch added to facets if DisplayLibraryFacets=home' );
-    ok( !defined $query->{aggregations}{holdingbranch},
-        'holdingbranch not added to facets if DisplayLibraryFacets=home' );
-};
-
-1;
-- 
2.11.0