Tomas Cohen Arazi
0e6a18bb62
The current tests fail to run if the configuration entry is missing. This is problematic on jenkins and should be fixed. To test: - On master, having koha-conf.xml without (or commented) an <elasticsearch> entry - Run: $ prove t/db_dependent/Koha_ElasticSearch_Indexer.t \ t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t -v => FAIL: Tests fail due to missing configuration entry - Apply the patch - Run: $ prove t/db_dependent/Koha_ElasticSearch_Indexer.t \ t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t -v => SUCCESS: Tests pass, and the ES-configuration-dependent tests are skipped - Have elasticsearch running and the koha-conf.xml entry - Run: $ prove t/db_dependent/Koha_ElasticSearch_Indexer.t \ t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t -v => SUCCESS: Same results as without the patch - Sign off Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
55 lines
1.5 KiB
Perl
55 lines
1.5 KiB
Perl
# 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::ElasticSearch::Indexer');
|
|
|
|
my $indexer;
|
|
ok(
|
|
$indexer = Koha::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;
|