Branch Coverage

blib/lib/App/ElasticSearch/Utilities.pm
Criterion Covered Total %
branch 65 364 17.8


line true false branch
97 0 4 if $_init_complete++
98 4 0 if $ARGV_AT_INIT
135 0 4 if (defined $opt_ref and XXX) { }
137 0 0 $COPY_ARGV ? :
141 0 4 if ($parsed_argv) { }
151 0 4 $COPY_ARGV ? :
170 4 0 if ($ENV{'HOME'})
178 24 0 unless -f $config_file
185 0 0 unless (eval {
189 0 4 @ConfigData ? :
249 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{'date-separator'} ? :
0 4 exists $_GLOBALS{'datesep'} ? :
0 4 exists $opts->{'datesep'} ? :
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'} ? :
250 0 4 if $DEF{'NOOP'}
252 4 0 if ($DEF{'NOPROXY'})
265 0 4 if (index($DEF{'DATESEP'}, "-") >= 0)
285 0 1 unless keys %DEF
287 1 0 unless exists $_GLOBALS{$key}
297 0 0 unless keys %DEF
303 0 0 if exists $_auth_cache{$host}
310 0 0 if ($DEF{'HOST'} eq $host)
316 0 0 unless $name
317 0 0 if (my $v = es_local_index_meta($k, $name))
328 0 0 defined $netrc ? :
0 0 defined $DEF{'USERNAME'} ? :
0 0 $meta{'http-username'} ? :
333 0 0 defined $netrc ? :
345 0 0 unless keys %DEF
349 0 0 unless length $exec and -x $exec
357 0 0 if (@err or $rc != 0)
374 0 0 unless keys %DEF
382 0 0 unless keys %DEF
384 0 0 if $DEF{'INSECURE'}
385 0 0 if $DEF{'CACERT'}
386 0 0 if $DEF{'CAPATH'}
387 0 0 if $DEF{'CERT'}
388 0 0 if $DEF{'KEY'}
393 0 0 if defined $CURRENT_VERSION
401 0 0 $DEF{'PASSEXEC'} ? :
403 0 0 if @auth
410 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) { }
415 0 0 if ($ver)
416 0 0 if ($ver->{'distribution'} and $ver->{'distribution'} eq 'opensearch') { }
426 0 0 unless $try{'tls'}
433 0 0 unless $try{'auth'}
436 0 0 unless $DEF{'PASSEXEC'}
444 0 0 if (not defined $CURRENT_VERSION or $CURRENT_VERSION <= 2)
446 0 0 ref $resp->content ? :
0 0 if $resp->content
459 0 0 unless keys %DEF
469 0 0 if ($DEF{'PROTO'} eq "https")
471 0 0 if $DEF{'PASSEXEC'}
475 0 0 if (defined $override_servers) { }
476 0 0 XXX ? :
484 0 0 if (@servers > 0)
485 0 0 @servers > 1 ? :
493 0 0 unless $name
494 0 0 if (my $v = es_local_index_meta($k, $name))
511 0 0 if (not defined $instance and defined $CLUSTER_MASTER)
516 0 0 if defined $instance
519 0 0 if (defined $cluster and $cluster->{'master_node'})
521 0 0 if ($local->{'nodes'} and $local->{'nodes'}{$cluster->{'master_node'}})
525 0 0 unless defined $instance
531 0 0 ref $_[0] eq 'App::ElasticSearch::Utilities::Connection' ? :
533 0 0 unless defined $CURRENT_VERSION
542 0 0 if (exists $options->{'index'})
543 0 0 if (my $index_in = delete $options->{'index'})
545 0 0 if ($index_in eq '_all') { }
550 0 0 XXX ? :
557 0 0 if ($url =~ /^_(cat|stats)/u and $index) { }
0 0 elsif ($index) { }
571 0 0 $url eq '_search' && $options->{'method'} eq 'POST' ? :
573 0 0 if ($modification)
575 0 0 if (not $DEF{'NOOP'} and $DEF{'MASTERONLY'})
576 0 0 unless (es_master())
582 0 0 if ($DEF{'NOOP'})
583 0 0 $DEF{'MASTERONLY'} && !es_master() ? :
593 0 0 unless defined $resp
597 0 0 if $resp->code != 200
601 0 0 if (not $resp->is_success) { }
0 0 elsif (not defined $resp->content && (XXX || length $resp->content)) { }
606 0 0 $cause->{'index'} ? :
610 0 0 unless (eval {
631 0 0 unless (keys %_nodes)
633 0 0 unless (defined $res)
642 0 0 wantarray ? :
648 0 0 unless (defined $_indices_meta)
650 0 0 unless (defined $result)
658 0 0 wantarray ? :
671 0 0 unless keys %DEF
674 0 0 if $args{'state'} eq "closed"
678 0 0 !exists $args{'_all'} && defined $DEF{'BASE'} ? :
681 0 0 if (defined $DEF{'INDEX'}) { }
0 0 elsif (not exists $args{'_all'} and $args{'check_state'} and $args{'state'} eq 'open') { }
687 0 0 if (my $res = es_request($wildcard . "/_stats/docs"))
696 0 0 XXX ? :
702 0 0 if (not exists $args{'_all'}) { }
705 0 0 if ($args{'state'} ne "all" and $args{'check_state'})
707 0 0 unless $result
711 0 0 unless $index =~ /$p->{'re'}/u
714 0 0 if ($args{'older'} and defined $DEF{'DAYS'}) { }
0 0 elsif ($args{'check_dates'} and defined $DEF{'DAYS'}) { }
716 0 0 if (not defined $days_old or $days_old < $DEF{'DAYS'})
723 0 0 if (not defined $days_old) { }
0 0 elsif ($DEF{'DAYS'} >= 0 and $days_old >= $DEF{'DAYS'}) { }
742 0 0 wantarray ? :
749 0 48 unless defined $index
751 0 48 unless keys %DEF
754 48 0 if ($index =~ s/[-_]$PATTERN_REGEX{'DATE'}.*//ou) { }
0 0 elsif ($index =~ s/[-_]\d{4}([.-])\d{2}\g{1}\d{2}(?:[-_.]\d+)?$//u) { }
770 0 24 unless defined $index
774 0 24 unless defined $stripped and length $stripped
777 3 21 unless (exists $_stripped{$stripped})
779 5 0 if defined $_
781 1 2 index($stripped, '_') >= 0 ? :
799 0 24 unless defined $index
801 0 24 unless keys %DEF
803 24 0 if (my($dateStr) = $index =~ /($PATTERN_REGEX{'DATE'})/u)
805 24 0 if (length $DEF{'DATESEP'}) { }
815 0 24 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})