AFS-Command

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

=head2 AFS::Object::VolumeHeader 'accesses' attribute was incorrect

The actual attribute on the objects was named "access".  Oops.  The
attribute was changed to "accesses" to match the documentation, and
the string that is parsed in vos output.

=head1 Changes in 1.4

=head1 Enhancements

=head2 Test suite is disabled by default.

There is a well intentioned effort to automatically test all new
submissions to CPAN (see http://testers.cpan.org).  Unfortunately, the
AFS-Command package can't be tested automatically, since it requires a
fair amount of configuration.  You have to specify a cell name, some
fileserver names and partitions, etc.

By default, the tests will all be skipped if the configured cell name
in the CONFIG file has not been modified, thus allowing the automated
CPAN testing to continue, automatically, without the author getting a

Changes.html  view on Meta::CPAN

	<LI><A HREF="#Bugs">Bugs</A>
	<UL>

		<LI><A HREF="#AFS_Object_VolumeHeader_acces">AFS::Object::VolumeHeader 'accesses' attribute was incorrect</A>
	</UL>

	<LI><A HREF="#Changes_in_1_4">Changes in 1.4</A>
	<LI><A HREF="#Enhancements">Enhancements</A>
	<UL>

		<LI><A HREF="#Test_suite_is_disabled_by_defaul">Test suite is disabled by default.</A>
	</UL>

	<LI><A HREF="#Bugs">Bugs</A>
	<UL>

		<LI><A HREF="#Volume_status_value_inconsistenc">Volume status value inconsistency</A>
		<LI><A HREF="#AFS_Command_VOS_examine_parse">AFS::Command::VOS->examine parses busy and offline messages</A>
	</UL>

	<LI><A HREF="#Changes_in_1_3">Changes in 1.3</A>

ToDo.html  view on Meta::CPAN

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#Enhancements">Enhancements</A>
	<UL>

		<LI><A HREF="#Accept_AFS_Object_objects_as_ar">Accept AFS::Object objects as arguments</A>
		<LI><A HREF="#stderr_handling">stderr handling</A>
		<LI><A HREF="#Test_Suite_fs_lsmount_using_mul">Test Suite: fs lsmount using multiple dirs</A>
	</UL>

	<LI><A HREF="#Bugs">Bugs</A>
	<UL>

		<LI><A HREF="#stdout_stderr_buffering_will_bre">stdout/stderr buffering will break the fs examine/diskfree commands</A>
	</UL>

</UL>
<!-- INDEX END -->

t/01vos_dumprestore.t  view on Meta::CPAN

# See ..../src/LICENSE for terms of distribution.
#

# print STDERR Data::Dumper->Dump([$vos],['vos']);

use strict;
use English;
use Data::Dumper;

use vars qw(
	    $TestCounter
	    $TestTotal
	    $Loaded
	    %Volnames
	   );

BEGIN {
    require "./util/lib/parse_config";
}

BEGIN {
    $| = 1;
    if ( $AFS::Command::Tests::Config{AFS_COMMAND_DISABLE_TESTS} =~ /\bvos\b/ ) {
	$TestTotal = 0;
    } elsif ( $AFS::Command::Tests::Config{AFS_COMMAND_CELLNAME} eq 'your.cell.name' ) {
	$TestTotal = 0;
    } else {
	$TestTotal = 19;
    }
    print "1..$TestTotal\n";
}

END {print "not ok 1\n" unless $Loaded;}
use AFS::Command::VOS 1.99;
$Loaded = 1;
$TestCounter = 1;
print "ok $TestCounter\n";
$TestCounter++;

exit 0 unless $TestTotal;

#
# First, let's get all the config data we need.
#
my $volname_prefix = $AFS::Command::Tests::Config{AFS_COMMAND_VOLNAME_PREFIX} || do {
    print "not ok $TestCounter..$TestTotal\n";
    die "Missing configuration variable AFS_COMMAND_VOLNAME_PREFIX\n";
};

my $cell = $AFS::Command::Tests::Config{AFS_COMMAND_CELLNAME} || do {
    print "not ok $TestCounter..$TestTotal\n";
    die "Missing configuration variable AFS_COMMAND_CELLNAME\n";
};

my $partition_list = $AFS::Command::Tests::Config{AFS_COMMAND_PARTITION_LIST} || do {
    print "not ok $TestCounter..$TestTotal\n";
    die "Missing configuration variable AFS_COMMAND_PARTITION_LIST\n";
};

my $binary = $AFS::Command::Tests::Config{AFS_COMMAND_BINARY_VOS} || 'vos';

my %enabled =
  (
   gzip		=> $AFS::Command::Tests::Config{AFS_COMMAND_GZIP_ENABLED},
   bzip2	=> $AFS::Command::Tests::Config{AFS_COMMAND_BZIP2_ENABLED},
  );
$enabled{gunzip} = $enabled{gzip};
$enabled{bunzip2} = $enabled{bzip2};

my $dumpfilter = $AFS::Command::Tests::Config{AFS_COMMAND_DUMP_FILTER};
my $restorefilter = $AFS::Command::Tests::Config{AFS_COMMAND_RESTORE_FILTER};

my $tmproot = $AFS::Command::Tests::Config{AFS_COMMAND_TMP_ROOT};

my @servers 		= ();
my @partitions		= ();
my $server_primary 	= "";
my $partition_primary 	= "";

foreach my $serverpart ( split(/\s+/,$partition_list) ) {

    my ($server,$partition) = split(/:/,$serverpart);

    unless ( $server && $partition ) {
	print "not ok $TestCounter..$TestTotal\n";
	die "Invalid server:/partition specification: '$serverpart'\n";
    }

    $server_primary = $server unless $server_primary;
    $partition_primary = $partition unless $partition_primary;

    push(@servers,$server);
    push(@partitions,$partition);

}

#
# If the constructor fails, we're doomed.
#
my $vos = AFS::Command::VOS->new
  (
   command		=> $binary,
  );
if ( ref $vos && $vos->isa("AFS::Command::VOS") ) {
    print "ok $TestCounter\n";
    $TestCounter++;
} else {
    print "not ok $TestCounter..$TestTotal\n";
    die "Unable to instantiate AFS::Command::VOS object\n";
}

#
# Create a volume.
#
my $volname = $volname_prefix . $PID;

my $result = $vos->create
  (
   server		=> $server_primary,
   partition		=> $partition_primary,
   name			=> $volname,
   cell			=> $cell,
  );
if ( $result ) {
    print "ok $TestCounter\n";
    $TestCounter++;
    $Volnames{$volname}++;
} else {
    print "not ok $TestCounter..$TestTotal\n";
    die("Unable to create volume '$volname' on server '$server_primary:$partition_primary'" .
	"in cell '$cell'\n" . "Errors from vos command:\n" . $vos->errors());
}

#
# OK, let's create a few dump files, in different ways.
#
# First, a vanilla dump, nothing special.
#
my %files =

t/20fs_basic.t  view on Meta::CPAN

# See ..../src/LICENSE for terms of distribution.
#

# print STDERR Data::Dumper->Dump([$vos],['vos']);

use strict;
use English;
use Data::Dumper;

use vars qw(
	    $TestCounter
	    $TestTotal
	    $Loaded
	   );

BEGIN {
    require "./util/lib/parse_config";
}

BEGIN {
    $| = 1;
    if ( $AFS::Command::Tests::Config{AFS_COMMAND_DISABLE_TESTS} =~ /\bfs\b/ ) {
	$TestTotal = 0;
    } elsif ( $AFS::Command::Tests::Config{AFS_COMMAND_CELLNAME} eq 'your.cell.name' ) {
	$TestTotal = 0;
    } else {
	$TestTotal = 124;
    }
    print "1..$TestTotal\n";
}

END {print "not ok 1\n" unless $Loaded;}
use AFS::Command::FS 1.99;
$Loaded = 1;
$TestCounter = 1;
print "ok $TestCounter\n";
$TestCounter++;

exit 0 unless $TestTotal;

my $cell = $AFS::Command::Tests::Config{AFS_COMMAND_CELLNAME} || do {
    print "not ok $TestCounter..$TestTotal\n";
    die "Missing configuration variable AFS_COMMAND_CELLNAME\n";
};

my $pathafs = $AFS::Command::Tests::Config{AFS_COMMAND_PATHNAME_AFS} || do {
    print "not ok $TestCounter..$TestTotal\n";
    die "Missing configuration variable AFS_COMMAND_PATHNAME_AFS\n";
};

my $pathnotafs = "/var/tmp";

my $pathbogus = "/this/does/not/exist";

my $binary = $AFS::Command::Tests::Config{AFS_COMMAND_BINARY_FS} || 'fs';

#
# If the constructor fails, we're doomed.
#
my $fs = AFS::Command::FS->new
  (
   command		=> $binary,
  );
if ( ref $fs && $fs->isa("AFS::Command::FS") ) {
    print "ok $TestCounter\n";
    $TestCounter++;
} else {
    print "not ok $TestCounter..$TestTotal\n";
    die "Unable to instantiate AFS::Command::FS object\n";
}

#
# fs checkservers
#
my $result = $fs->checkservers();
if ( ref $result && $result->isa("AFS::Object::CacheManager") ) {
    print "ok $TestCounter\n";
    $TestCounter++;
} else {
    print "not ok $TestCounter..$TestTotal\n";
    die "Unable to call checkservers:\n" . $fs->errors();
}

my $servers = $result->servers();
if ( ref $servers eq 'ARRAY' ) {
    print "ok $TestCounter\n";
} else {
    print "not ok $TestCounter\n";
    warn("Not an ARRAY ref: fs->checkservers->servers()\n");
}
$TestCounter++;

$result = $fs->checkservers
  (
   interval		=> 0,
  );
if ( ref $result && $result->isa("AFS::Object::CacheManager") ) {
    print "ok $TestCounter\n";
    $TestCounter++;
} else {
    print "not ok $TestCounter..$TestTotal\n";
    die "Unable to call checkservers:\n" . $fs->errors();
}

if ( $result->interval() =~ /^\d+$/ ) {
    print "ok $TestCounter\n";
} else {
    print "not ok $TestCounter\n";
    warn("Not an integer: fs->checkservers->interval()\n");
}
$TestCounter++;

#
# All the common _paths_method methods
#
my $paths = [ $pathafs, $pathnotafs, $pathbogus ];

my %pathops =
  (
   diskfree			=> [qw( volname total used avail percent )],
   examine			=> [qw( volname total avail id quota )],

util/lib/parse_config  view on Meta::CPAN

#
# (c) 2003-2004 Morgan Stanley and Co.
# See ..../src/LICENSE for terms of distribution.
#
# Parse our config file to get the parameters we need for the tests
#

# NOTE: this is used ONLY for the installation procedures, and not in
# the production code itself.

package AFS::Command::Tests;

use vars qw(%Config);

my $config = "/no/such/path";

foreach my $relpath ( qw( . .. ../.. ../../.. ) ) {
    next unless -f "$relpath/CONFIG";
    $config = "$relpath/CONFIG";
    last;
}

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.485 second using v1.00-cache-2.02-grep-82fe00e-cpan-585fae043c8 )