Branch Coverage

blib/lib/MogileFS/Admin.pm
Criterion Covered Total %
branch 4 140 2.8


line true false branch
9 1 0 unless ref $self
13 0 1 $args{'readonly'} ? :
15 0 1 if $args{'timeout'}
16 0 1 unless $$self{'backend'} = 'MogileFS::Backend'->new(%backend_args)
24 0 0 $_[0] ? :
0 0 if @_
31 0 0 unless my $res = $$self{'backend'}->do_request('replicate_now', {})
40 0 0 $hostid ? :
41 0 0 unless my $res = $$self{'backend'}->do_request('get_hosts', $args)
57 0 0 $devid ? :
58 0 0 unless my $res = $$self{'backend'}->do_request('get_devices', $args)
79 0 0 unless my $res = $$self{'backend'}->do_request('list_fids', {'from', $fromfid, 'to', $count})
98 0 0 unless @_
99 0 0 unless my $res = $$self{'backend'}->do_request('clear_cache', {map({$_, 1;} @_)})
109 0 0 unless my $res = $$self{'backend'}->do_request('get_domains', {})
131 0 0 if $$self{'readonly'}
136 0 0 unless $$res{'domain'} eq $domain
144 0 0 if $$self{'readonly'}
148 0 0 unless $$self{'backend'}->do_request('delete_domain', {'domain', $domain})
174 0 0 if $$self{'readonly'}
178 0 0 unless $$self{'backend'}->do_request('delete_class', {'domain', $domain, 'class', $class})
191 0 0 unless $host
194 0 0 unless ref $args eq 'HASH'
195 0 0 unless $$args{'ip'} and $$args{'port'}
204 0 0 unless $host
207 0 0 unless ref $args eq 'HASH'
215 0 0 if $$self{'readonly'}
218 0 0 unless $host
220 0 0 unless $$self{'backend'}->do_request('delete_host', {'host', $host})
228 0 0 if $$self{'readonly'}
232 0 0 unless my $res = $$self{'backend'}->do_request('create_device', \%opts)
241 0 0 if $$self{'readonly'}
244 0 0 unless $host
245 0 0 unless $device
248 0 0 unless ref $args eq 'HASH'
251 0 0 if ($$args{'status'})
252 0 0 unless $self->change_device_state($host, $device, $$args{'status'})
254 0 0 if ($$args{'weight'})
255 0 0 unless $self->change_device_weight($host, $device, $$args{'weight'})
266 0 0 if $$self{'readonly'}
270 0 0 unless my $res = $$self{'backend'}->do_request('set_state', {'host', $host, 'device', $device, 'state', $state})
283 0 0 if $$self{'readonly'}
288 0 0 unless my $res = $$self{'backend'}->do_request('set_weight', {'host', $host, 'device', $device, 'weight', $weight})
306 0 0 unless $keys_res
314 0 0 unless (defined $weight and length $weight)
335 0 0 if (defined $weight and length $weight and $weight != 1)
346 0 0 unless $keys_res
363 0 0 unless $slave_res
379 0 0 if (exists $slave_keys{$key})
383 0 0 unless my $res = $backend->do_request('set_server_setting', {'key', "slave_$key", 'value', join('|', $dsn, $username, $password)})
404 0 0 unless (exists $slave_keys{$key})
408 0 0 unless my $get_res = $backend->do_request('server_setting', {'key', "slave_$key"})
414 0 0 if exists $opts{'dsn'}
415 0 0 if exists $opts{'username'}
416 0 0 if exists $opts{'password'}
418 0 0 unless my $set_res = $backend->do_request('set_server_setting', {'key', "slave_$key", 'value', join('|', $dsn, $username, $password)})
434 0 0 unless (exists $slave_keys{$key})
438 0 0 unless my $res = $backend->do_request('set_server_setting', {'key', "slave_$key", 'value', undef})
465 0 0 if %opts
486 0 0 if %args
509 0 0 unless $res
517 0 0 unless $res
569 0 0 unless $MogileFS::DEBUG
581 0 0 if $$self{'readonly'}
591 0 0 unless $$res{'class'} eq $class
599 0 0 if $$self{'readonly'}
608 0 0 unless $$res{'host'} eq $host
615 0 0 unless $$self{'backend'}
621 0 0 unless $$self{'backend'}
627 0 0 unless $$self{'backend'}