static bool run(TestRunner& tr) { if(tr.isDefaultEnabled()) { runHttpHeaderTest(tr); runHttpNormalizePath(tr); runCookieTest(tr); } if(tr.isTestEnabled("http-server")) { runHttpServerTest(tr); } if(tr.isTestEnabled("http-pong")) { runHttpPongTest(tr); } if(tr.isTestEnabled("http-client-get")) { runHttpClientGetTest(tr); } if(tr.isTestEnabled("http-client-redirect-loop")) { runHttpClientRedirectLoopTest(tr); } if(tr.isTestEnabled("http-client-post")) { runHttpClientPostTest(tr); } if(tr.isTestEnabled("ping")) { runPingTest(tr); } return true; }
TEST_F(ServiceStateMachineFixture, TestSinkError) { _tl->setNextFailure(MockTL::Sink); ASSERT_EQ(ServiceStateMachine::State::Ended, runPingTest()); ASSERT_TRUE(_tl->ranSource()); ASSERT_TRUE(_tl->ranSink()); }
static bool run(TestRunner& tr) { if(tr.isTestEnabled("pong")) { runPingTest(tr); } return true; }
TEST_F(ServiceStateMachineFixture, TestSourceError) { _tl->setNextFailure(MockTL::Source); ASSERT_EQ(ServiceStateMachine::State::Ended, runPingTest()); ASSERT_THROWS(checkPingOk(), MsgAssertionException); ASSERT_TRUE(_tl->ranSource()); ASSERT_FALSE(_tl->ranSink()); }
TEST_F(ServiceStateMachineFixture, TestThrowHandling) { _sep->setUassertInHandler(); ASSERT_EQ(ServiceStateMachine::State::Ended, runPingTest()); ASSERT_THROWS(checkPingOk(), MsgAssertionException); ASSERT_TRUE(_tl->ranSource()); ASSERT_FALSE(_tl->ranSink()); }
// This test checks that after the SSM has been cleaned up, the SessionHandle that it passed // into the Client doesn't have any dangling shared_ptr copies. TEST_F(ServiceStateMachineFixture, TestSessionCleanupOnDestroy) { // Set a cleanup hook so we know that the cleanup hook actually gets run when the session // is destroyed bool hookRan = false; _ssm->setCleanupHook([&hookRan] { hookRan = true; }); // Do a regular ping test so that all the processMessage/sinkMessage code gets exercised ASSERT_EQ(ServiceStateMachine::State::Source, runPingTest()); // Set the next run up to fail on source (like a disconnected client) and run it _tl->setNextFailure(MockTL::Source); _ssm->runNext(); ASSERT_EQ(ServiceStateMachine::State::Ended, _ssm->state()); // Check that after the failure and the session getting cleaned up that the SessionHandle // only has one use (our copy in _sessionHandle) ASSERT_EQ(_ssm.use_count(), 1); // Make sure the cleanup hook actually ran. ASSERT_TRUE(hookRan); }
TEST_F(ServiceStateMachineFixture, TestOkaySimpleCommand) { ASSERT_EQ(ServiceStateMachine::State::Source, runPingTest()); checkPingOk(); }