App-MtAws
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
t/integration/lwp.t view on Meta::CPAN
}
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request GET => "$proto://$base/quit";
my $resp = $ua->request($req);
sub initialize_processes
{
if (@ARGV && $ARGV[0] eq 'daemon') {
my $d = $proto eq 'http' ?
HTTP::Daemon->new(Timeout => 20, LocalAddr => '127.0.0.1') :
HTTP::Daemon::SSL->new(Timeout => 20, LocalAddr => '127.0.0.1'); # need certs/ dir
$SIG{PIPE}='IGNORE';
$| = 1;
print "Please to meet you at: <URL:", $d->url, ">\n";
$!=0;
while (my $c = $d->accept) {
my $r = $c->get_request;
if ($r) {
my @p = $r->uri->path_segments;
shift @p;
t/unit/glacier_request.t view on Meta::CPAN
cmp_deeply [@throttle_args], [(1..$retries)];
my @matches = $out =~ /PID $$ HTTP connection problem \(timeout\?\). Will retry \(\d+ seconds spent for request\)/g;
is scalar @matches, $retries;
};
it "should throttle X-Died and read timeout" => sub {
my $g = App::MtAws::GlacierRequest->new({%common_options});
($g->{method}, $g->{url}) = ('GET', 'test');
my @throttle_args;
App::MtAws::GlacierRequest->expects('_max_retries')->any_number->returns($retries);
App::MtAws::GlacierRequest->expects('throttle')->returns(sub { push @throttle_args, shift } )->exactly($retries);
LWP::UserAgent->expects('request')->returns(HTTP::Response->new(200, 'OK', [ 'X-Died' => 'Read Timeout at']))->exactly($retries);
my $resp = capture_stdout my $out, sub {
assert_raises_exception sub {
$g->perform_lwp();
}, exception 'too_many_tries' => "Request was not successful after $retries retries";
};
ok ! defined $resp;
cmp_deeply [@throttle_args], [(1..$retries)];
my @matches = $out =~ /PID $$ HTTP connection problem. Will retry \(\d+ seconds spent for request\)/g;
is scalar @matches, $retries;
};
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.464 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )