Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (37 sloc) 0.987 kB
use strict;
use warnings;
use HTTP::Request::Common;
use Plack::Test;
use Test::More;
$Plack::Test::Impl = 'Server';
$ENV{PLACK_SERVER} = 'Starman';
test_psgi
app => sub {
my $env = shift;
return [ 200, [ 'Content-Type' => 'text/plain' ], [$$] ];
},
client => sub {
my %seen_pid;
my $cb = shift;
for (1..23) {
my $res = $cb->(GET "/");
$seen_pid{$res->content}++;
}
cmp_ok(keys(%seen_pid), '<=', 5, 'In non-harakiri mode, pid is reused');
};
test_psgi
app => sub {
my $env = shift;
$env->{'psgix.harakiri.commit'} = 1;
return [ 200, [ 'Content-Type' => 'text/plain' ], [$$] ];
},
client => sub {
my %seen_pid;
my $cb = shift;
for (1..23) {
my $res = $cb->(GET "/");
$seen_pid{$res->content}++;
}
is keys(%seen_pid), 23, 'In Harakiri mode, each pid only used once';
};
done_testing;
Jump to Line
Something went wrong with that request. Please try again.