File: 34_bulk_cxn_errors.t

package info (click to toggle)
libsearch-elasticsearch-client-1-0-perl 6.81-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 444 kB
  • sloc: perl: 2,788; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 952 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use Test::More;
use Test::Deep;
use Test::Exception;

use strict;
use warnings;
use lib 't/lib';
use Log::Any::Adapter;

$ENV{ES_VERSION} = '1_0';
$ENV{ES}           = '10.255.255.1:9200';
$ENV{ES_SKIP_PING} = 1;
$ENV{ES_CXN_POOL}  = 'Static';
$ENV{ES_TIMEOUT}   = 1;

my $es = do "es_sync.pl" or die( $@ || $! );
SKIP: {
    skip
        "IO::Socket::IP doesn't respect timeout: https://rt.cpan.org/Ticket/Display.html?id=103878",
        3
        if $es->transport->cxn_pool->cxn_factory->cxn_class eq
        'Search::Elasticsearch::Cxn::HTTPTiny'
        && $^V =~ /^v5.2\d/;

    # Check that the buffer is not cleared on a NoNodes exception

    my $b = $es->bulk_helper( index => 'foo', type => 'bar' );
    $b->create_docs( { foo => 'bar' } );

    is $b->_buffer_count, 1, "Buffer count pre-flush";
    throws_ok { $b->flush } 'Search::Elasticsearch::Error::NoNodes';
    is $b->_buffer_count, 1, "Buffer count post-flush";

}

done_testing;