Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 83 lines (75 sloc) 2.253 kB
80eae7b @stash Coverage for the feersum script and Feersum::Runner
authored
1 #!perl
2 use strict;
3 use Test::More;
4 use blib;
5 use lib 't'; use Utils;
6 BEGIN {
7 plan skip_all => "Need Plack >= 0.9950 to run this test"
8 unless eval 'require Plack; $Plack::VERSION >= 0.995';
9 plan skip_all => "Need Test::TCP 1.06 to run this test"
10 unless eval 'require Test::TCP; $Test::TCP::VERSION >= 1.06';
11 }
12
fd00b9d @stash Try fix persistent fail of 62-plack-runner.t
authored
13 plan tests => 6;
80eae7b @stash Coverage for the feersum script and Feersum::Runner
authored
14 use Test::TCP;
29ef597 @stash improve the runner test, negating a FIXME
authored
15 use Config;
16
80eae7b @stash Coverage for the feersum script and Feersum::Runner
authored
17 test_tcp(
6177ef0 @audreyt * Fix mismerge of 62-plack-runner.t so it agrees with the 1.000-fixes…
audreyt authored
18 client => sub {
19 my $port = shift;
20 my $cv = AE::cv;
21 $cv->begin;
22 my $cli = simple_client GET => '/',
23 port => $port,
24 name => 'feersum runner',
25 sub {
26 my ($body,$headers) = @_;
27 is $headers->{Status}, 200, "script http success";
28 like $body, qr/^Hello customer number 0x[0-9a-f]+$/;
29 $cv->end;
30 };
31 $cv->recv;
32 },
80eae7b @stash Coverage for the feersum script and Feersum::Runner
authored
33 server => sub {
34 my $port = shift;
6177ef0 @audreyt * Fix mismerge of 62-plack-runner.t so it agrees with the 1.000-fixes…
audreyt authored
35 exec "$^X -Mblib blib/script/feersum --listen localhost:$port ".
36 "eg/app.psgi";
80eae7b @stash Coverage for the feersum script and Feersum::Runner
authored
37 },
38 );
39
fd00b9d @stash Try fix persistent fail of 62-plack-runner.t
authored
40 my $plackup;
bf95c1b @stash Try to fix 62-plack-runner again
authored
41 for my $key (qw(bin scriptdir sitebin sitescript vendbin vendscript)) {
42 my $dir = $Config{$key.'exp'};
43 next unless $dir;
29ef597 @stash improve the runner test, negating a FIXME
authored
44
fd00b9d @stash Try fix persistent fail of 62-plack-runner.t
authored
45 my $pu = "$dir/plackup";
bf95c1b @stash Try to fix 62-plack-runner again
authored
46 next unless (-e $pu && -x _);
47
48 my $plackup_ver = `$^X $pu --version`;
49 next unless ($plackup_ver =~ /Plack (\d.\d+)/ && $1 >= 0.995);
50
51 $plackup = $pu;
52 chomp $plackup_ver;
53 diag "found plackup: $plackup ($plackup_ver)";
54 last;
fd00b9d @stash Try fix persistent fail of 62-plack-runner.t
authored
55 }
6cab347 @stash Add a version check to the plackup locator
authored
56
fd00b9d @stash Try fix persistent fail of 62-plack-runner.t
authored
57 SKIP: {
bf95c1b @stash Try to fix 62-plack-runner again
authored
58 skip "can't locate plackup in script/bin dirs", 3
fd00b9d @stash Try fix persistent fail of 62-plack-runner.t
authored
59 unless $plackup;
60 test_tcp(
61 client => sub {
62 my $port = shift;
63 my $cv = AE::cv;
64 $cv->begin;
65 my $cli = simple_client GET => '/',
66 port => $port,
67 name => 'plackup runner',
68 sub {
69 my ($body,$headers) = @_;
70 is $headers->{Status}, 200, "script http success";
71 like $body, qr/^Hello customer number 0x[0-9a-f]+$/;
72 $cv->end;
73 };
74 $cv->recv;
75 },
76 server => sub {
77 my $port = shift;
78 exec "$^X -Mblib $plackup -E deployment ".
79 "-s Feersum --listen localhost:$port eg/app.psgi";
80 },
81 );
82 }
Something went wrong with that request. Please try again.