Skip to content

Commit 281306e

Browse files
committed
check mapping in test compatible with newer ES
1 parent 7c53b66 commit 281306e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

t/server/controller/author.t

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use strict;
22
use warnings;
33
use lib 't/lib';
44

5-
use MetaCPAN::Server::Test qw( app GET POST test_psgi );
5+
use MetaCPAN::Server::Test qw( app GET POST test_psgi es );
66
use MetaCPAN::TestHelpers qw( decode_json_ok test_cache_headers );
77
use Test::More;
88

@@ -56,7 +56,12 @@ test_psgi app, sub {
5656

5757
if ( $k eq '/author/_mapping' ) {
5858
my ($index) = keys %{$json};
59-
ok( ref $json->{$index}{mappings}{author} eq 'HASH', '_mapping' );
59+
my $check_mappings = $json->{$index}{mappings};
60+
if ( es->api_version le '5_0' ) {
61+
$check_mappings = $check_mappings->{author};
62+
}
63+
64+
ok( $check_mappings->{properties}{name}, '_mapping' );
6065
}
6166
}
6267

0 commit comments

Comments
 (0)