Added some stress testing
[catagits/Catalyst-Runtime.git] / t / live / component / controller / action / multipath.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin;
7 use lib "$FindBin::Bin/../../../lib";
8
9 use Test::More tests => 160;
10 use Catalyst::Test 'TestApp';
11
12 my $content = q/foo
13 bar
14 baz
15 /;
16
17 for ( 1 .. 10 ) {
18
19     # Local
20     {
21         ok(
22             my $response =
23               request('http://localhost/action/multipath/multipath'),
24             'Request'
25         );
26         ok( $response->is_success, 'Response Successful 2xx' );
27         is( $response->content_type, 'text/plain', 'Response Content-Type' );
28         is( $response->content, $content, 'Content is a stream' );
29     }
30
31     # Global
32     {
33         ok( my $response = request('http://localhost/multipath'), 'Request' );
34         ok( $response->is_success, 'Response Successful 2xx' );
35         is( $response->content_type, 'text/plain', 'Response Content-Type' );
36         is( $response->content, $content, 'Content is a stream' );
37     }
38
39     # Path('/multipath1')
40     {
41         ok( my $response = request('http://localhost/multipath1'), 'Request' );
42         ok( $response->is_success, 'Response Successful 2xx' );
43         is( $response->content_type, 'text/plain', 'Response Content-Type' );
44         is( $response->content, $content, 'Content is a stream' );
45     }
46
47     # Path('multipath2')
48     {
49         ok(
50             my $response =
51               request('http://localhost/action/multipath/multipath2'),
52             'Request'
53         );
54         ok( $response->is_success, 'Response Successful 2xx' );
55         is( $response->content_type, 'text/plain', 'Response Content-Type' );
56         is( $response->content, $content, 'Content is a stream' );
57     }
58 }