Test Fails to Retain Transaction - Inactivity Timeout
cajundave opened this issue · comments
We have a test file whose first test is failing in our openshift environment, but not on our development environments. The failure is always on the first test run in that file.
It's really only testing the validation of the parameters in the spec
sub get_authentication_methods { my $c = shift->openapi->valid_input or return; ....
Below I've extracted the important pieces of the tests that demonstrate that the first run always fails with an Inactivity Timeout.
sh-4.2$ perl -Ilib -Iextlib/lib/perl5/ -MTest::Mojo -e 'my $t = Test::Mojo->new("SNAPI::IVR"); $t->get_ok( "/v1/customer-authentication-methods" => { "X-API-Server-Token" => "SECRET_KEY" } => form => { "ani" =>"dhasfdhgsafghda", "email" => "stuff" } );$t = Test::Mojo->new("SNAPI::IVR"); $t->get_ok( "/v1/customer-authentication-methods" => { "X-API-Server-Token" => "SECRET_KEY" } => form => { "ani" =>"dhasfdhgsafghda", "email" => "stuff" } )'
# Inactivity timeout
not ok 1 - GET /v1/customer-authentication-methods
# Failed test 'GET /v1/customer-authentication-methods'
# at -e line 1.
ok 2 - GET /v1/customer-authentication-methods
# Tests were run but no plan was declared and done_testing() was not seen.
When we run the test with verbose, we can see the debug and warn for the first test with the appropriate response, but $t simply does not get the proper transaction.
Any insight into what might be causing this is greatly welcome.
One thought we had was we were using scl perl 5.16 in openshift, which is multi-threaded. But I installed multi-threaded 5.16 on my dev environment, and the first run still passes.
Sorry, I have no idea 😞
Maybe you want to run with a combination of...
- DBI_TRACE=15
- JSON_VALIDATOR_DEBUG=2
- MOJO_SERVER_DEBUG=1
- MOJO_OPENAPI_DEBUG=1
If you do, please DO NOT paste the output here.
So, this test was failing the other day in minishift. Now that we've launched to openshift, the test is passing. As far as we can tell the image was built in precisely the same way as in minishift, and we haven't had any similar testing issues. Best guess is that minishift can be reasonably slower than openshift.
I was unaware of those mojo debug flags though. Those are super useful! Thank you for the heads up!