15:35:23 < klapperl> connect_timeout timer seems always to be started at 
load
                     time of Test::Mojo. What is the recommended way to 
start
                     it later?
15:35:49 < klapperl> If I have MOJO_CONNECT_TIMEOUT=1 and run ...use
                     Test::Mojo;sleep 2;Test::Mojo->new("MyApp")->get_ok...
                     then I get Connect timeout.

Here is the full program that irritates me. Passes all tests without the 
sleep, fails with it. I would not have expected this behaviour, I would 
have expected that the sleep has no influence:

# MOJO_IOLOOP_DEBUG=1 MOJO_CONNECT_TIMEOUT=1 MOJO_EVENTEMITTER_DEBUG=1 perl 
-e '
package MyApp;
use Mojo::Base "Mojolicious";
sub startup {
  my $self = shift;
  $self->routes->get("/welcome")->to("foo#hello");
}
package MyApp::Controller::Foo;
use Mojo::Base "Mojolicious::Controller";
sub hello {
  my $self = shift;
  $self->render(text => "Hello!");
}
package main;
use Test::More;
use Test::Mojo;sleep 2;Test::Mojo->new("MyApp")
->get_ok("/welcome")->status_is(200)->content_is("Hello!");
done_testing;
'
-- Reactor initialized (Mojo::Reactor::EV)
-- Emit start in Mojo::UserAgent (0)
-- Emit error in Mojo::IOLoop::Client (1)
-- Emit finish in Mojo::Message::Response (0)
-- Emit finish in Mojo::Transaction::HTTP (0)
# Connect timeout
not ok 1 - GET /welcome
#   Failed test 'GET /welcome'
#   at -e line 16.
not ok 2 - 200 OK
#   Failed test '200 OK'
#   at -e line 16.
#          got: undef
#     expected: '200'
not ok 3 - exact match for content
#   Failed test 'exact match for content'
#   at -e line 16.
#          got: ''
#     expected: 'Hello!'
1..3
# Looks like you failed 3 tests of 3.



Thanks,
-- 
andreas

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to