Commit | Line | Data |
c7ded7aa |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
4853fb50 |
6 | use Test::More; |
7 | BEGIN { |
8 | plan skip_all => 'set TEST_STRESS to enable this test' |
9 | unless $ENV{TEST_STRESS}; |
10 | } |
11 | |
c7ded7aa |
12 | use FindBin; |
13 | use lib "$FindBin::Bin/lib"; |
c7ded7aa |
14 | use Catalyst::Test 'TestApp'; |
c7ded7aa |
15 | |
16 | our ( $iters, $tests ); |
17 | |
18 | BEGIN { |
15f0ede8 |
19 | eval "use YAML"; |
20 | plan skip_all => 'YAML is required for this test' if $@; |
21 | |
c7ded7aa |
22 | $iters = $ENV{TEST_STRESS} || 10; |
23 | $tests = YAML::LoadFile("$FindBin::Bin/optional_stress.yml"); |
24 | |
25 | my $total_tests = 0; |
26 | map { $total_tests += scalar @{ $tests->{$_} } } keys %{$tests}; |
27 | plan tests => $iters * $total_tests; |
28 | } |
29 | |
30 | for ( 1 .. $iters ) { |
31 | run_tests(); |
32 | } |
33 | |
34 | sub run_tests { |
35 | foreach my $test_group ( keys %{$tests} ) { |
36 | foreach my $test ( @{ $tests->{$test_group} } ) { |
37 | ok( request($test), $test_group . ' - ' . $test ); |
38 | } |
39 | } |
40 | } |