Branch Coverage

blib/lib/App/ElasticSearch/Utilities.pm
Criterion Covered Total %
branch 62 354 17.5


line true false branch
107 0 4 if $_init_complete++
108 4 0 if $ARGV_AT_INIT
144 0 4 if (defined $opt_ref and XXX) { }
146 0 0 $COPY_ARGV ? :
150 0 4 if ($parsed_argv) { }
160 0 4 $COPY_ARGV ? :
179 4 0 if ($ENV{'HOME'})
187 24 0 unless -f $config_file
194 0 0 unless (eval {
198 0 4 @ConfigData ? :
254 0 4 exists $_GLOBALS{'host'} ? :
0 4 exists $opts->{'local'} ? :
0 4 exists $opts->{'host'} ? :
0 4 exists $_GLOBALS{'port'} ? :
0 4 exists $opts->{'port'} ? :
0 4 exists $_GLOBALS{'proto'} ? :
0 4 exists $opts->{'proto'} ? :
0 4 exists $_GLOBALS{'timeout'} ? :
0 4 exists $opts->{'timeout'} ? :
0 4 exists $_GLOBALS{'noop'} ? :
0 4 exists $opts->{'noop'} ? :
0 4 exists $_GLOBALS{'keep-proxy'} ? :
0 4 exists $opts->{'keep-proxy'} ? :
0 4 exists $opts->{'master-only'} ? :
0 4 exists $opts->{'index'} ? :
0 4 exists $_GLOBALS{'base'} ? :
0 4 exists $opts->{'base'} ? :
0 4 exists $opts->{'pattern'} ? :
0 4 exists $_GLOBALS{'days'} ? :
0 4 exists $opts->{'days'} ? :
0 4 exists $_GLOBALS{'http-username'} ? :
0 4 exists $opts->{'http-username'} ? :
0 4 exists $_GLOBALS{'password-exec'} ? :
0 4 exists $opts->{'password-exec'} ? :
0 4 exists $_GLOBALS{'insecure'} ? :
0 4 exists $opts->{'insecure'} ? :
0 4 exists $_GLOBALS{'cacert'} ? :
0 4 exists $opts->{'cacert'} ? :
0 4 exists $_GLOBALS{'capath'} ? :
0 4 exists $opts->{'capath'} ? :
0 4 exists $_GLOBALS{'cert'} ? :
0 4 exists $opts->{'cert'} ? :
0 4 exists $_GLOBALS{'key'} ? :
0 4 exists $opts->{'key'} ? :
255 0 4 if $DEF{'NOOP'}
257 4 0 if ($DEF{'NOPROXY'})
281 0 1 unless keys %DEF
283 1 0 unless exists $_GLOBALS{$key}
293 0 0 unless keys %DEF
299 0 0 if exists $_auth_cache{$host}
306 0 0 if ($DEF{'HOST'} eq $host)
312 0 0 unless $name
313 0 0 if (my $v = es_local_index_meta($k, $name))
324 0 0 defined $netrc ? :
0 0 defined $DEF{'USERNAME'} ? :
0 0 $meta{'http-username'} ? :
329 0 0 defined $netrc ? :
341 0 0 unless keys %DEF
345 0 0 unless length $exec and -x $exec
353 0 0 if (@err or $rc != 0)
370 0 0 unless keys %DEF
378 0 0 unless keys %DEF
380 0 0 if $DEF{'INSECURE'}
381 0 0 if $DEF{'CACERT'}
382 0 0 if $DEF{'CAPATH'}
383 0 0 if $DEF{'CERT'}
384 0 0 if $DEF{'KEY'}
389 0 0 if defined $CURRENT_VERSION
397 0 0 $DEF{'PASSEXEC'} ? :
399 0 0 if @auth
406 0 0 if ($resp->is_success) { }
0 0 elsif ($resp->code == 500 and $resp->message eq 'Server closed connection without sending any data back') { }
0 0 elsif ($resp->code == 401) { }
411 0 0 if ($ver)
412 0 0 if ($ver->{'distribution'} and $ver->{'distribution'} eq 'opensearch') { }
422 0 0 unless $try{'tls'}
429 0 0 unless $try{'auth'}
432 0 0 unless $DEF{'PASSEXEC'}
440 0 0 if (not defined $CURRENT_VERSION or $CURRENT_VERSION <= 2)
442 0 0 ref $resp->content ? :
0 0 if $resp->content
455 0 0 unless keys %DEF
465 0 0 if ($DEF{'PROTO'} eq "https")
467 0 0 if $DEF{'PASSEXEC'}
471 0 0 if (defined $override_servers) { }
472 0 0 XXX ? :
480 0 0 if (@servers > 0)
481 0 0 @servers > 1 ? :
489 0 0 unless $name
490 0 0 if (my $v = es_local_index_meta($k, $name))
507 0 0 if (not defined $instance and defined $CLUSTER_MASTER)
512 0 0 if defined $instance
515 0 0 if (defined $cluster and $cluster->{'master_node'})
517 0 0 if ($local->{'nodes'} and $local->{'nodes'}{$cluster->{'master_node'}})
521 0 0 unless defined $instance
527 0 0 ref $_[0] eq 'App::ElasticSearch::Utilities::Connection' ? :
529 0 0 unless defined $CURRENT_VERSION
538 0 0 if (exists $options->{'index'})
539 0 0 if (my $index_in = delete $options->{'index'})
541 0 0 if ($index_in eq '_all') { }
546 0 0 XXX ? :
553 0 0 if ($url =~ /^_(cat|stats)/u and $index) { }
0 0 elsif ($index) { }
567 0 0 $url eq '_search' && $options->{'method'} eq 'POST' ? :
569 0 0 if ($modification)
571 0 0 if (not $DEF{'NOOP'} and $DEF{'MASTERONLY'})
572 0 0 unless (es_master())
578 0 0 if ($DEF{'NOOP'})
579 0 0 $DEF{'MASTERONLY'} && !es_master() ? :
589 0 0 unless defined $resp
593 0 0 if $resp->code != 200
597 0 0 if (not $resp->is_success) { }
0 0 elsif (not defined $resp->content && (XXX || length $resp->content)) { }
602 0 0 $cause->{'index'} ? :
606 0 0 unless (eval {
627 0 0 unless (keys %_nodes)
629 0 0 unless (defined $res)
638 0 0 wantarray ? :
644 0 0 unless (defined $_indices_meta)
646 0 0 unless (defined $result)
654 0 0 wantarray ? :
667 0 0 unless keys %DEF
670 0 0 if $args{'state'} eq "closed"
674 0 0 !exists $args{'_all'} && defined $DEF{'BASE'} ? :
677 0 0 if (defined $DEF{'INDEX'}) { }
0 0 elsif (not exists $args{'_all'} and $args{'check_state'} and $args{'state'} eq 'open') { }
683 0 0 if (my $res = es_request($wildcard . "/_stats/docs"))
692 0 0 XXX ? :
698 0 0 if (not exists $args{'_all'}) { }
701 0 0 if ($args{'state'} ne "all" and $args{'check_state'})
703 0 0 unless $result
707 0 0 unless $index =~ /$p->{'re'}/u
710 0 0 if ($args{'older'} and defined $DEF{'DAYS'}) { }
0 0 elsif ($args{'check_dates'} and defined $DEF{'DAYS'}) { }
712 0 0 if (not defined $days_old or $days_old < $DEF{'DAYS'})
718 0 0 if (not defined $days_old) { }
0 0 elsif ($DEF{'DAYS'} >= 0 and $days_old >= $DEF{'DAYS'}) { }
737 0 0 wantarray ? :
744 0 68 unless defined $index
746 0 68 unless keys %DEF
749 68 0 if (my $base = $index =~ s/[^a-z0-9]+$PATTERN_REGEX{'DATE'}.*$//ioru)
761 0 34 unless defined $index
767 0 34 unless defined $stripped and length $stripped
770 5 29 unless (exists $_stripped{$stripped})
772 9 0 if defined $_
774 1 4 index($stripped, '_') >= 0 ? :
791 0 34 unless defined $index
793 0 34 unless keys %DEF
796 33 1 if ($index =~ /[^a-z0-9]$PATTERN_REGEX{'DATE'}/iou)
803 0 33 if (@date != 3)
814 0 33 unless $idx_time
831 0 0 if (defined $result and XXX)
836 0 0 wantarray ? :
843 0 0 unless defined $index and length $index
844 0 0 if exists $_valid_index{$index}
861 0 0 unless defined $result
866 0 0 exists $result->{$idx}{'mappings'} ? :
870 0 0 exists $ref->{'properties'} ? :
886 0 0 unless @path
895 0 0 if ($nested_path)
906 0 0 unless XXX
908 0 0 if (exists $ref->{'properties'} and XXX) { }
0 0 elsif (exists $ref->{'type'}) { }
909 0 0 if $ref->{'type'} and $ref->{'type'} eq "nested"
919 0 0 if (exists $ref->{'fields'} and XXX)
930 0 0 ref $ref ? :
0 0 XXX ? :
976 0 0 unless (XXX)
988 0 0 unless (defined $index and length $index and es_index_valid($index))
1006 0 0 if (defined $result)
1013 0 0 wantarray ? :
1037 0 0 if @nodes
1085 0 0 unless keys %DEF
1087 0 0 exists $DEF{$key} ? :
1094 0 0 unless keys %DEF
1096 0 0 if (exists $_GLOBALS{'meta'})
1103 0 0 if (exists $meta->{$check} and exists $meta->{$check}{$key})