Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Try fix persistent fail of 62-plack-runner.t

This seems to fail frequently via CPAN Testers.  Replaced looking for plack in the PATH with a search through the site/vend bin/script dirs.  If an executable script isn't found, skip the tests.
  • Loading branch information...
commit fd00b9d4455888459d94b718dbb044e001316879 1 parent ad440cb
@stash authored
Showing with 37 additions and 28 deletions.
  1. +37 −28 t/62-plack-runner.t
View
65 t/62-plack-runner.t
@@ -10,8 +10,9 @@ BEGIN {
unless eval 'require Test::TCP; $Test::TCP::VERSION >= 1.06';
}
-plan tests => 7;
+plan tests => 6;
use Test::TCP;
+use Config;
test_tcp(
client => sub {
@@ -36,30 +37,38 @@ test_tcp(
},
);
-# XXX: ugh, what's a better cross-platform way of doing this?
-my $plackup = `which plackup`;
-chomp $plackup;
-ok $plackup, 'found plackup';
-
-test_tcp(
- client => sub {
- my $port = shift;
- my $cv = AE::cv;
- $cv->begin;
- my $cli = simple_client GET => '/',
- port => $port,
- name => 'plackup runner',
- sub {
- my ($body,$headers) = @_;
- is $headers->{Status}, 200, "script http success";
- like $body, qr/^Hello customer number 0x[0-9a-f]+$/;
- $cv->end;
- };
- $cv->recv;
- },
- server => sub {
- my $port = shift;
- exec "$^X -Mblib $plackup -E deployment ".
- "-s Feersum --listen localhost:$port eg/app.psgi";
- },
-);
+my $plackup;
+for my $dir (@Config{qw(sitebin sitescript vendbin vendscript)}) {
+ my $pu = "$dir/plackup";
+ if (-e $pu && -x _) {
+ $plackup = $pu;
+ diag "plackup: $plackup";
+ last;
+ }
+}
+SKIP: {
+ skip "can't locate plackup in sitebin/sitescript/vendbin/vendscript", 2
+ unless $plackup;
+ test_tcp(
+ client => sub {
+ my $port = shift;
+ my $cv = AE::cv;
+ $cv->begin;
+ my $cli = simple_client GET => '/',
+ port => $port,
+ name => 'plackup runner',
+ sub {
+ my ($body,$headers) = @_;
+ is $headers->{Status}, 200, "script http success";
+ like $body, qr/^Hello customer number 0x[0-9a-f]+$/;
+ $cv->end;
+ };
+ $cv->recv;
+ },
+ server => sub {
+ my $port = shift;
+ exec "$^X -Mblib $plackup -E deployment ".
+ "-s Feersum --listen localhost:$port eg/app.psgi";
+ },
+ );
+}
Please sign in to comment.
Something went wrong with that request. Please try again.