Branch Coverage

blib/lib/App/ElasticSearch/Utilities.pm
Criterion Covered Total %
branch 65 362 17.9


line true false branch
95 0 4 if $_init_complete++
96 4 0 if $ARGV_AT_INIT
133 0 4 if (defined $opt_ref and XXX) { }
135 0 0 $COPY_ARGV ? :
139 0 4 if ($parsed_argv) { }
149 0 4 $COPY_ARGV ? :
168 4 0 if ($ENV{'HOME'})
176 24 0 unless -f $config_file
183 0 0 unless (eval {
187 0 4 @ConfigData ? :
247 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'} ? :
248 0 4 if $DEF{'NOOP'}
250 4 0 if ($DEF{'NOPROXY'})
263 0 4 if (index($DEF{'DATESEP'}, "-") >= 0)
283 0 1 unless keys %DEF
285 1 0 unless exists $_GLOBALS{$key}
295 0 0 unless keys %DEF
301 0 0 if exists $_auth_cache{$host}
308 0 0 if ($DEF{'HOST'} eq $host)
314 0 0 unless $name
315 0 0 if (my $v = es_local_index_meta($k, $name))
326 0 0 defined $netrc ? :
0 0 defined $DEF{'USERNAME'} ? :
0 0 $meta{'http-username'} ? :
331 0 0 defined $netrc ? :
343 0 0 unless keys %DEF
347 0 0 unless length $exec and -x $exec
355 0 0 if (@err or $rc != 0)
372 0 0 unless keys %DEF
380 0 0 unless keys %DEF
382 0 0 if $DEF{'INSECURE'}
383 0 0 if $DEF{'CACERT'}
384 0 0 if $DEF{'CAPATH'}
385 0 0 if $DEF{'CERT'}
386 0 0 if $DEF{'KEY'}
391 0 0 if defined $CURRENT_VERSION
399 0 0 $DEF{'PASSEXEC'} ? :
401 0 0 if @auth
408 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) { }
413 0 0 if ($ver)
414 0 0 if ($ver->{'distribution'} and $ver->{'distribution'} eq 'opensearch') { }
424 0 0 unless $try{'tls'}
431 0 0 unless $try{'auth'}
434 0 0 unless $DEF{'PASSEXEC'}
442 0 0 if (not defined $CURRENT_VERSION or $CURRENT_VERSION <= 2)
444 0 0 ref $resp->content ? :
0 0 if $resp->content
457 0 0 unless keys %DEF
467 0 0 if ($DEF{'PROTO'} eq "https")
469 0 0 if $DEF{'PASSEXEC'}
473 0 0 if (defined $override_servers) { }
474 0 0 XXX ? :
482 0 0 if (@servers > 0)
483 0 0 @servers > 1 ? :
491 0 0 unless $name
492 0 0 if (my $v = es_local_index_meta($k, $name))
509 0 0 if (not defined $instance and defined $CLUSTER_MASTER)
514 0 0 if defined $instance
517 0 0 if (defined $cluster and $cluster->{'master_node'})
519 0 0 if ($local->{'nodes'} and $local->{'nodes'}{$cluster->{'master_node'}})
523 0 0 unless defined $instance
529 0 0 ref $_[0] eq 'App::ElasticSearch::Utilities::Connection' ? :
531 0 0 unless defined $CURRENT_VERSION
540 0 0 if (exists $options->{'index'})
541 0 0 if (my $index_in = delete $options->{'index'})
543 0 0 if ($index_in eq '_all') { }
548 0 0 XXX ? :
555 0 0 if ($url =~ /^_(cat|stats)/ and $index) { }
0 0 elsif ($index) { }
569 0 0 $url eq '_search' && $options->{'method'} eq 'POST' ? :
571 0 0 if ($modification)
573 0 0 if (not $DEF{'NOOP'} and $DEF{'MASTERONLY'})
574 0 0 unless (es_master())
580 0 0 if ($DEF{'NOOP'})
581 0 0 $DEF{'MASTERONLY'} && !es_master() ? :
591 0 0 unless defined $resp
595 0 0 if $resp->code != 200
599 0 0 if (not $resp->is_success) { }
0 0 elsif (not defined $resp->content && (XXX || length $resp->content)) { }
604 0 0 $cause->{'index'} ? :
608 0 0 unless (eval {
629 0 0 unless (keys %_nodes)
631 0 0 unless (defined $res)
640 0 0 wantarray ? :
646 0 0 unless (defined $_indices_meta)
648 0 0 unless (defined $result)
656 0 0 wantarray ? :
669 0 0 unless keys %DEF
672 0 0 if $args{'state'} eq "closed"
676 0 0 !exists $args{'_all'} && defined $DEF{'BASE'} ? :
679 0 0 if (defined $DEF{'INDEX'}) { }
0 0 elsif (not exists $args{'_all'} and $args{'check_state'} and $args{'state'} eq 'open') { }
685 0 0 if (my $res = es_request($wildcard . "/_stats/docs"))
694 0 0 XXX ? :
700 0 0 if (not exists $args{'_all'}) { }
703 0 0 if ($args{'state'} ne "all" and $args{'check_state'})
705 0 0 unless $result
709 0 0 unless $index =~ /$p->{'re'}/
712 0 0 if ($args{'older'} and defined $DEF{'DAYS'}) { }
0 0 elsif ($args{'check_dates'} and defined $DEF{'DAYS'}) { }
714 0 0 if (not defined $days_old or $days_old < $DEF{'DAYS'})
721 0 0 if (not defined $days_old) { }
0 0 elsif ($DEF{'DAYS'} >= 0 and $days_old >= $DEF{'DAYS'}) { }
740 0 0 wantarray ? :
747 0 48 unless defined $index
749 0 48 unless keys %DEF
751 48 0 if ($index =~ s/[-_]$PATTERN_REGEX{'DATE'}.*//)
763 0 24 unless defined $index
767 0 24 unless defined $stripped and length $stripped
770 3 21 unless (exists $_stripped{$stripped})
772 5 0 if defined $_
774 1 2 index($stripped, '_') >= 0 ? :
792 0 24 unless defined $index
794 0 24 unless keys %DEF
796 24 0 if (my($dateStr) = $index =~ /($PATTERN_REGEX{'DATE'})/)
798 24 0 if (length $DEF{'DATESEP'}) { }
808 0 24 unless $idx_time
824 0 0 if (defined $result and XXX)
829 0 0 wantarray ? :
836 0 0 unless defined $index and length $index
837 0 0 if exists $_valid_index{$index}
854 0 0 unless defined $result
859 0 0 exists $result->{$idx}{'mappings'} ? :
863 0 0 exists $ref->{'properties'} ? :
879 0 0 unless @path
888 0 0 if ($nested_path)
899 0 0 unless XXX
901 0 0 if (exists $ref->{'properties'} and XXX) { }
0 0 elsif (exists $ref->{'type'}) { }
902 0 0 if $ref->{'type'} and $ref->{'type'} eq "nested"
912 0 0 if (exists $ref->{'fields'} and XXX)
923 0 0 ref $ref ? :
0 0 XXX ? :
969 0 0 unless (XXX)
981 0 0 unless (defined $index and length $index and es_index_valid($index))
999 0 0 if (defined $result)
1006 0 0 wantarray ? :
1030 0 0 if @nodes
1048 0 0 unless keys %DEF
1050 0 0 exists $DEF{$key} ? :
1057 0 0 unless keys %DEF
1059 0 0 if (exists $_GLOBALS{'meta'})
1066 0 0 if (exists $meta->{$check} and exists $meta->{$check}{$key})