omniti-labs / Net--RabbitMQ

Perl bindings to the librabbitmq-c AMQP library.
Other
25 stars 18 forks source link

Tests in 012_timeout.t fail #1

Closed clintongormley closed 13 years ago

clintongormley commented 13 years ago

Hiya

When running make test initiially I was getting this:

#   Failed test 'connect'
#   at t/012_timeout.t line 16.
#          got: ''
#     expected: anything else

then I shut down the rabbitmq server, and that test passed.

However, I'm still getting this failure:

t/012_timeout.t .. 1/4 
#   Failed test 'timeout'
#   at t/012_timeout.t line 18.
#     '0.599854'
#         <
#     '0.05'
# Looks like you failed 1 test of 4.
t/012_timeout.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/4 subtests 

ta

clint

postwait commented 13 years ago

I thought I addressed this before. The timeout is firing over half a second after it should (this is perl's alarm). Something sounds wrong (not with the AMQP stuff).

iamb commented 12 years ago

This issue is valid. The test for timeout is failing for me too by almost exactly .6 seconds each time. That's because it is attempting to test a timeout by connecting to 127.0.0.2. Instead of timing out, that gives a connection refused which is pretty quick. $duration gets set to a value not much above zero because that was quick. The absolute value of $duration - $attempt becomes very close to $attempt (as seen in the failure, very close to 0.6). If the $attempt is changed to 0.7 for example, it fails almost exactly 0.7 seconds early.

I can't think of a reliable way to create a timeout condition to test off the top of my head. This test does cause Net::RabbitMQ to fail to build for me. Sigh...it's late...it builds, just fails to install without forcing it.