AFS-Command
view release on metacpan or search on metacpan
t/02vos_volserver.t view on Meta::CPAN
my $attribute_test = 1;
foreach my $partname ( @partitions ) {
my $partition = $dst->getPartition($partname);
unless ( ref $partition && $partition->isa("AFS::Object::Partition") ) {
print "not ok $TestCounter..$TestTotal\n";
die("Inconsistent data in listpart and partinfo output\n" .
"Found partname '$partname' in one, but not the other");
}
if ( $partition->hasAttribute('available') ) {
my $available = $partition->available();
my $total = $partition->total();
unless ( $available =~ /^\d+$/ && $total =~ /^\d+$/ && $available < $total ) {
$attribute_test = 0;
warn("Invalid attributes for partition '$partname'\n" .
"Available is '$available', total is '$total'\n" .
"both must be numeric, and available less than total\n");
}
}
}
print "# AFS::Command::VOS->hasAttribute()\n";
print "not " unless $attribute_test;
print "ok $TestCounter\n";
$TestCounter++;
}
#
# Now that we can trust listpart and partinfo, let's see if we can
# trust listvol.
#
#
# First, let's make sure the partition lists are consisent.
#
my $listvol = $vos->listvol
(
server => $server_primary,
cell => $cell,
fast => 1,
);
unless ( ref $listvol && $listvol->isa("AFS::Object::VolServer") ) {
print "not ok $TestCounter..$TestTotal\n";
die("Unable to query listvol for server '$server_primary', in cell '$cell':\n" .
Data::Dumper->Dump([$vos],['vos']));
}
print "# AFS::Command::VOS->listvol()\n";
print "ok $TestCounter\n";
$TestCounter++;
my $listpart_names = { map { $_ => 1 } $listpart->getPartitionNames() };
my $listvol_names = { map { $_ => 1 } $listvol->getPartitionNames() };
my $partname_errors = 0;
foreach my $hashpair ( [ $listpart_names, $listvol_names ],
[ $listvol_names, $listpart_names ] ) {
my ($src,$dst) = @$hashpair;
foreach my $partname ( keys %$src ) {
$partname_errors++ unless $dst->{$partname};
}
}
if ( $partname_errors ) {
print "not ok $TestCounter\n";
warn("Partition lists from listpart and listvol are inconsistent:\n" .
Data::Dumper->Dump([$listpart_names,$listvol_names],['listpart','listvol']));
} else {
print "# AFS::Command::VOS, listpart vs. listvol comparison\n";
print "ok $TestCounter\n";
}
$TestCounter++;
#
# Now, let's get more verbose output, for just one partition.
#
$listvol = $vos->listvol
(
server => $server_primary,
partition => $partition_primary,
cell => $cell,
);
unless ( ref $listvol && $listvol->isa("AFS::Object::VolServer") ) {
print "not ok $TestCounter..$TestTotal\n";
die("Unable to query listvol for server '$server_primary', " .
"partition '$partition_primary', in cell '$cell':\n" .
Data::Dumper->Dump([$vos],['vos']));
}
print "# AFS::Command::VOS->listvol()\n";
print "ok $TestCounter\n";
$TestCounter++;
my $partition = $listvol->getPartition($partition_primary);
unless ( ref $partition && $partition->isa("AFS::Object::Partition") ) {
print "not ok $TestCounter..$TestTotal\n";
die("Unable to query listvol for server '$server_primary', " .
"partition '$partition_primary', in cell '$cell':\n" .
Data::Dumper->Dump([$listvol],['listvol']));
}
print "# AFS::Command::VOS->getPartition()\n";
print "ok $TestCounter\n";
$TestCounter++;
my $id_errors = 0;
my @ids = $partition->getVolumeIds();
unless ( @ids ) {
( run in 1.333 second using v1.01-cache-2.11-cpan-13bb782fe5a )