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 { |
8a1b06be |
17 | use JSON::MaybeXS qw(decode_json); |
18 | |
19 | my $test_data = do { |
20 | open my $fh, '<:raw', "$FindBin::Bin/optional_stress.json" or die "$!"; |
21 | local $/; |
22 | <$fh>; |
23 | }; |
15f0ede8 |
24 | |
c7ded7aa |
25 | $iters = $ENV{TEST_STRESS} || 10; |
8a1b06be |
26 | $tests = decode_json($test_data); |
c7ded7aa |
27 | |
28 | my $total_tests = 0; |
29 | map { $total_tests += scalar @{ $tests->{$_} } } keys %{$tests}; |
30 | plan tests => $iters * $total_tests; |
31 | } |
32 | |
33 | for ( 1 .. $iters ) { |
34 | run_tests(); |
35 | } |
36 | |
37 | sub run_tests { |
38 | foreach my $test_group ( keys %{$tests} ) { |
39 | foreach my $test ( @{ $tests->{$test_group} } ) { |
40 | ok( request($test), $test_group . ' - ' . $test ); |
41 | } |
42 | } |
43 | } |