File-Rsync-Mirror-Recent

 view release on metacpan or  search on metacpan

t/02-aurora.t  view on Meta::CPAN


This help

=item B<--sleep1=f>

Defaults to 0.2. Seconds to sleep between the cration of the initial
files.

=item B<--sleep2=f>

Defaults to 0.1. Seconds to sleep between the iterations of the second
phase.

=item B<--iterations=i>

Defaults to 30. Number of iterations in the second phase.

=back

=head1 DESCRIPTION

In the first phase the test creates a couple of files and injects them
into the tree, one after the other. There are tunable C<sleep1> pauses
between each file creation. In the second phase the test runs
alternating C<aggregate> commands on the server and C<rmirror>
commands on the client. After each iteration both directories are

t/02-aurora.t  view on Meta::CPAN


our %Opt;
lock_keys %Opt, map { /([^=!]+)/ } @opt;
GetOptions(\%Opt,
           @opt,
          ) or pod2usage(1);

$Opt{cleanup}    = 1   unless defined $Opt{cleanup};
$Opt{sleep1}     = 0.2 unless defined $Opt{sleep1};
$Opt{sleep2}     = 0.1 unless defined $Opt{sleep2};
$Opt{iterations} = 30  unless defined $Opt{iterations};
$Opt{files}      = 15  unless defined $Opt{files};


use File::Basename qw(dirname);
use File::Find;
use File::Path qw(mkpath rmtree);
use Time::HiRes qw(time sleep);
$^T = time; # force it to float
use YAML::Syck;

t/02-aurora.t  view on Meta::CPAN

            sleep $Opt{"sleep1"};
        }
    }
    # speeding up the process a little bit:
    superevent("sleeping");
    my $rfs = $rrr->recentfiles;
    for my $rf (@$rfs) {
        $rf->sleep_per_connection(0);
    }
    $rrr->_rmirror_sleep_per_connection(0.001);
    for (my $t=0; $t < $Opt{iterations}; $t++) {
        $rf0->aggregate;
        $rrr->rmirror;
        archive;
        sleep $Opt{sleep2};
    }
    ok(1);
}

if ($Opt{cleanup}) {
    rmtree [$root_from, $root_to, "t/tmp"];



( run in 0.531 second using v1.01-cache-2.11-cpan-71847e10f99 )