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