From: Graham Knop Date: Thu, 27 Aug 2020 14:38:37 +0000 (+0200) Subject: clean up skips in test X-Git-Tag: v1.42~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Devel.git;a=commitdiff_plain;h=00c8a8df02eeac9ff52143f1302b79c3b4774598 clean up skips in test --- diff --git a/t/optional_http-server-restart.t b/t/optional_http-server-restart.t index 3718eeb..e914365 100644 --- a/t/optional_http-server-restart.t +++ b/t/optional_http-server-restart.t @@ -61,54 +61,47 @@ my @files = ( # change some files and make sure the server restarts itself NON_ERROR_RESTART: for ( 1 .. 5 ) { - my $index = rand @files; - open my $pm, '>>', $files[$index] - or die "Unable to open $files[$index] for writing: $!"; - print $pm "\n"; - close $pm; - - if ( ! look_for_restart() ) { - SKIP: - { + SKIP : { + my $index = rand @files; + open my $pm, '>>', $files[$index] + or die "Unable to open $files[$index] for writing: $!"; + print $pm "\n"; + close $pm; + + if ( ! look_for_restart() ) { skip "Server did not restart, no sense in checking further", 1; } - next NON_ERROR_RESTART; - } - my $response = get("http://localhost:$port/"); - like( $response, qr/Welcome to the world of Catalyst/, - 'Non-error restart, request OK' ); + my $response = get("http://localhost:$port/"); + like( $response, qr/Welcome to the world of Catalyst/, + 'Non-error restart, request OK' ); + } } # add errors to the file and make sure server does die DIES_ON_ERROR: for ( 1 .. 5 ) { - my $index = rand @files; - open my $pm, '>>', $files[$index] - or die "Unable to open $files[$index] for writing: $!"; - print $pm "bleh"; - close $pm; - - if ( ! look_for_death() ) { - SKIP: - { + SKIP : { + my $index = rand @files; + open my $pm, '>>', $files[$index] + or die "Unable to open $files[$index] for writing: $!"; + print $pm "bleh"; + close $pm; + + if ( ! look_for_death() ) { skip "Server restarted, no sense in checking further", 2; } - next DIES_ON_ERROR; - } - copy_test_app(); - if ( ! look_for_restart() ) { - SKIP: - { + copy_test_app(); + + if ( ! look_for_restart() ) { skip "Server did not restart, no sense in checking further", 1; } - next DIES_ON_ERROR; - } - my $response = get("http://localhost:$port/"); - like( $response, qr/Welcome to the world of Catalyst/, - 'Non-error restart after death, request OK' ); + my $response = get("http://localhost:$port/"); + like( $response, qr/Welcome to the world of Catalyst/, + 'Non-error restart after death, request OK' ); + } } # multiple restart directories @@ -186,7 +179,7 @@ sub start_server { $waited++; if ( $waited >= 10 ) { - BAIL_OUT('Waited 10 seconds for server to start, to no avail'); + die 'Waited 10 seconds for server to start, to no avail'; } }