Created
May 27, 2016 12:45
-
-
Save bfaist/85869582a2caa64000f4a449c97ece4a to your computer and use it in GitHub Desktop.
Test::Mojo sleep test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojo::Base -strict; | |
use Test::More; | |
use Test::Mojo; | |
my $t = Test::Mojo->new('SleepTest'); | |
$t->ua->inactivity_timeout(0); | |
for(my $i = 0; $i < 10; $i++) { | |
$t->get_ok('/')->status_is(200)->content_like(qr/Mojolicious/i); | |
sleep 15; | |
} | |
done_testing(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
P14-4581:sleep_test faihh5$ perl ./script/sleep_test test -v ./t/basic.t | |
./t/basic.t .. [Fri May 27 08:44:14 2016] [debug] GET "/" | |
[Fri May 27 08:44:14 2016] [debug] Routing to controller "SleepTest::Controller::Example" and action "welcome" | |
[Fri May 27 08:44:14 2016] [debug] Rendering template "example/welcome.html.ep" | |
[Fri May 27 08:44:14 2016] [debug] Rendering template "layouts/default.html.ep" | |
[Fri May 27 08:44:14 2016] [debug] 200 OK (0.003844s, 260.146/s) | |
ok 1 - GET / | |
ok 2 - 200 OK | |
ok 3 - content is similar | |
# Premature connection close | |
not ok 4 - GET / | |
not ok 5 - 200 OK | |
# Failed test 'GET /' | |
# at ./t/basic.t line 11. | |
# Failed test '200 OK' | |
# at ./t/basic.t line 11. | |
# got: undef | |
# expected: '200' | |
not ok 6 - content is similar | |
# Failed test 'content is similar' | |
# at ./t/basic.t line 11. | |
# '' | |
# doesn't match '(?^i:Mojolicious)' | |
[Fri May 27 08:44:44 2016] [debug] GET "/" | |
[Fri May 27 08:44:44 2016] [debug] Routing to controller "SleepTest::Controller::Example" and action "welcome" | |
[Fri May 27 08:44:44 2016] [debug] Rendering cached template "example/welcome.html.ep" | |
[Fri May 27 08:44:44 2016] [debug] Rendering cached template "layouts/default.html.ep" | |
[Fri May 27 08:44:44 2016] [debug] 200 OK (0.00119s, 840.336/s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment