diff options
Diffstat (limited to 'test-dnsdisttcp_cc.cc')
-rw-r--r-- | test-dnsdisttcp_cc.cc | 171 |
1 files changed, 96 insertions, 75 deletions
diff --git a/test-dnsdisttcp_cc.cc b/test-dnsdisttcp_cc.cc index 0904441..22a27c6 100644 --- a/test-dnsdisttcp_cc.cc +++ b/test-dnsdisttcp_cc.cc @@ -19,7 +19,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef BOOST_TEST_DYN_LINK #define BOOST_TEST_DYN_LINK +#endif + #define BOOST_TEST_NO_MAIN #include <boost/test/unit_test.hpp> @@ -31,7 +34,6 @@ #include "dnsdist-tcp-downstream.hh" #include "dnsdist-tcp-upstream.hh" -struct DNSDistStats g_stats; GlobalStateHolder<NetmaskGroup> g_ACL; GlobalStateHolder<vector<DNSDistRuleAction> > g_ruleactions; GlobalStateHolder<vector<DNSDistResponseRuleAction> > g_respruleactions; @@ -49,7 +51,7 @@ bool checkDNSCryptQuery(const ClientState& cs, PacketBuffer& query, std::unique_ return false; } -bool checkQueryHeaders(const struct dnsheader* dh, ClientState&) +bool checkQueryHeaders(const struct dnsheader& dnsHeader, ClientState& clientState) { return true; } @@ -63,7 +65,7 @@ void handleResponseSent(const InternalQueryState& ids, double udiff, const Combo { } -static std::function<ProcessQueryResult(DNSQuestion& dq, std::shared_ptr<DownstreamState>& selectedBackend)> s_processQuery; +std::function<ProcessQueryResult(DNSQuestion& dq, std::shared_ptr<DownstreamState>& selectedBackend)> s_processQuery; ProcessQueryResult processQuery(DNSQuestion& dq, LocalHolders& holders, std::shared_ptr<DownstreamState>& selectedBackend) { @@ -74,7 +76,7 @@ ProcessQueryResult processQuery(DNSQuestion& dq, LocalHolders& holders, std::sha return ProcessQueryResult::Drop; } -bool responseContentMatches(const PacketBuffer& response, const DNSName& qname, const uint16_t qtype, const uint16_t qclass, const std::shared_ptr<DownstreamState>& remote, unsigned int& qnameWireLength) +bool responseContentMatches(const PacketBuffer& response, const DNSName& qname, const uint16_t qtype, const uint16_t qclass, const std::shared_ptr<DownstreamState>& remote) { return true; } @@ -209,11 +211,6 @@ public: BOOST_REQUIRE_EQUAL(step.request, !d_client ? ExpectedStep::ExpectedRequest::closeClient : ExpectedStep::ExpectedRequest::closeBackend); } - bool hasBufferedData() const override - { - return false; - } - bool isUsable() const override { return true; @@ -441,6 +438,39 @@ static void prependPayloadEditingID(PacketBuffer& buffer, const PacketBuffer& pa buffer.insert(buffer.begin(), newPayload.begin(), newPayload.end()); } +struct TestFixture +{ + TestFixture() + { + reset(); + } + TestFixture(const TestFixture&) = delete; + TestFixture(TestFixture&&) = delete; + TestFixture& operator=(const TestFixture&) = delete; + TestFixture& operator=(TestFixture&&) = delete; + ~TestFixture() + { + reset(); + } + + static void reset() + { + s_steps.clear(); + s_readBuffer.clear(); + s_writeBuffer.clear(); + s_backendReadBuffer.clear(); + s_backendWriteBuffer.clear(); + + g_proxyProtocolACL.clear(); + g_verbose = false; + IncomingTCPConnectionState::clearAllDownstreamConnections(); + + /* we _NEED_ to set this function to empty otherwise we might get what was set + by the last test, and we might not like it at all */ + s_processQuery = nullptr; + } +}; + static void testInit(const std::string& name, TCPClientThreadData& threadData) { #ifdef DEBUGLOG_ENABLED @@ -449,25 +479,16 @@ static void testInit(const std::string& name, TCPClientThreadData& threadData) (void) name; #endif - s_steps.clear(); - s_readBuffer.clear(); - s_writeBuffer.clear(); - s_backendReadBuffer.clear(); - s_backendWriteBuffer.clear(); - - g_proxyProtocolACL.clear(); - g_verbose = false; - IncomingTCPConnectionState::clearAllDownstreamConnections(); - + TestFixture::reset(); threadData.mplexer = std::make_unique<MockupFDMultiplexer>(); } #define TEST_INIT(str) testInit(str, threadData) -BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) +BOOST_FIXTURE_TEST_CASE(test_IncomingConnection_SelfAnswered, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared<MockupTLSCtx>(); localCS.tlsFrontend = std::make_shared<TLSFrontend>(tlsCtx); @@ -501,7 +522,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); } @@ -524,7 +545,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), query.size()); BOOST_CHECK(s_writeBuffer == query); } @@ -559,7 +580,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) dynamic_cast<MockupFDMultiplexer*>(threadData.mplexer.get())->setReady(-1); auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0) { threadData.mplexer->run(&now); } @@ -583,7 +604,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); } @@ -611,7 +632,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), query.size() * count); #endif } @@ -637,7 +658,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) dynamic_cast<MockupFDMultiplexer*>(threadData.mplexer.get())->setNotReady(-1); auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(threadData.mplexer->run(&now), 0); struct timeval later = now; later.tv_sec += g_tcpRecvTimeout + 1; @@ -673,7 +694,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) dynamic_cast<MockupFDMultiplexer*>(threadData.mplexer.get())->setNotReady(-1); auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(threadData.mplexer->run(&now), 0); struct timeval later = now; later.tv_sec += g_tcpRecvTimeout + 1; @@ -706,15 +727,15 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_SelfAnswered) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); } } -BOOST_AUTO_TEST_CASE(test_IncomingConnectionWithProxyProtocol_SelfAnswered) +BOOST_FIXTURE_TEST_CASE(test_IncomingConnectionWithProxyProtocol_SelfAnswered, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared<MockupTLSCtx>(); localCS.tlsFrontend = std::make_shared<TLSFrontend>(tlsCtx); @@ -767,7 +788,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionWithProxyProtocol_SelfAnswered) dynamic_cast<MockupFDMultiplexer*>(threadData.mplexer.get())->setNotReady(-1); auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(threadData.mplexer->run(&now), 0); BOOST_CHECK_EQUAL(s_writeBuffer.size(), query.size() * 2U); } @@ -794,7 +815,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionWithProxyProtocol_SelfAnswered) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); } @@ -824,7 +845,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionWithProxyProtocol_SelfAnswered) dynamic_cast<MockupFDMultiplexer*>(threadData.mplexer.get())->setNotReady(-1); auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(threadData.mplexer->run(&now), 0); struct timeval later = now; later.tv_sec += g_tcpRecvTimeout + 1; @@ -841,10 +862,10 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionWithProxyProtocol_SelfAnswered) } } -BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) +BOOST_FIXTURE_TEST_CASE(test_IncomingConnection_BackendNoOOOR, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared<MockupTLSCtx>(); localCS.tlsFrontend = std::make_shared<TLSFrontend>(tlsCtx); @@ -904,7 +925,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), query.size()); BOOST_CHECK(s_writeBuffer == query); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size()); @@ -944,7 +965,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size()); BOOST_CHECK(s_backendWriteBuffer == query); @@ -983,7 +1004,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size()); BOOST_CHECK(s_backendWriteBuffer == query); @@ -1026,7 +1047,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size()); BOOST_CHECK(s_backendWriteBuffer == query); @@ -1053,7 +1074,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), 0U); BOOST_CHECK_EQUAL(backend->outstanding.load(), 0U); @@ -1091,7 +1112,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size()); BOOST_CHECK_EQUAL(backend->outstanding.load(), 0U); @@ -1161,7 +1182,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) /* set the incoming descriptor as ready! */ dynamic_cast<MockupFDMultiplexer*>(threadData.mplexer.get())->setReady(-1); auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0) { threadData.mplexer->run(&now); } @@ -1222,7 +1243,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), 0U); BOOST_CHECK_EQUAL(backend->outstanding.load(), 0U); @@ -1258,7 +1279,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); struct timeval later = now; later.tv_sec += backend->d_config.tcpSendTimeout + 1; auto expiredWriteConns = threadData.mplexer->getTimeouts(later, true); @@ -1304,7 +1325,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); struct timeval later = now; later.tv_sec += backend->d_config.tcpRecvTimeout + 1; auto expiredConns = threadData.mplexer->getTimeouts(later, false); @@ -1361,7 +1382,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), 0U); BOOST_CHECK_EQUAL(backend->outstanding.load(), 0U); @@ -1417,7 +1438,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), query.size()); BOOST_CHECK(s_writeBuffer == query); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size()); @@ -1476,7 +1497,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), 0U); BOOST_CHECK_EQUAL(backend->outstanding.load(), 0U); @@ -1528,7 +1549,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size() * backend->d_config.d_retries); BOOST_CHECK_EQUAL(backend->outstanding.load(), 0U); @@ -1588,7 +1609,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), query.size()); BOOST_CHECK(s_writeBuffer == query); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size() * backend->d_config.d_retries); @@ -1629,7 +1650,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), 0U); BOOST_CHECK_EQUAL(s_backendWriteBuffer.size(), query.size()); BOOST_CHECK(s_backendWriteBuffer == query); @@ -1691,7 +1712,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(s_writeBuffer.size(), query.size() * count); BOOST_CHECK_EQUAL(backend->outstanding.load(), 0U); @@ -1733,7 +1754,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); BOOST_CHECK_EQUAL(backend->outstanding.load(), 0U); /* we need to clear them now, otherwise we end up with dangling pointers to the steps via the TLS context, etc */ @@ -1741,10 +1762,10 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) } } -BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) +BOOST_FIXTURE_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}); + ClientState localCS(local, true, false, 0, "", {}, true); /* enable out-of-order on the front side */ localCS.d_maxInFlightQueriesPerConn = 65536; @@ -1917,7 +1938,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0) { threadData.mplexer->run(&now); } @@ -2049,7 +2070,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); @@ -2229,7 +2250,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); @@ -2305,7 +2326,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } @@ -2388,7 +2409,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while ((threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } @@ -2505,7 +2526,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } @@ -2657,7 +2678,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0) { threadData.mplexer->run(&now); } @@ -2864,7 +2885,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } @@ -3038,7 +3059,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } @@ -3302,7 +3323,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } @@ -3428,7 +3449,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0) { threadData.mplexer->run(&now); } @@ -3513,7 +3534,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0) { threadData.mplexer->run(&now); } @@ -3578,7 +3599,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } @@ -3769,7 +3790,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0) { threadData.mplexer->run(&now); } @@ -3854,7 +3875,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } @@ -3881,10 +3902,10 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) } } -BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendNotOOOR) +BOOST_FIXTURE_TEST_CASE(test_IncomingConnectionOOOR_BackendNotOOOR, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}); + ClientState localCS(local, true, false, 0, "", {}, true); /* enable out-of-order on the front side */ localCS.d_maxInFlightQueriesPerConn = 65536; @@ -4086,7 +4107,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendNotOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0) { threadData.mplexer->run(&now); } @@ -4138,7 +4159,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendNotOOOR) }; auto state = std::make_shared<IncomingTCPConnectionState>(ConnectionInfo(&localCS, getBackendAddress("84", 4242)), threadData, now); - IncomingTCPConnectionState::handleIO(state, now); + state->handleIO(); while (!timeout && (threadData.mplexer->getWatchedFDCount(false) != 0 || threadData.mplexer->getWatchedFDCount(true) != 0)) { threadData.mplexer->run(&now); } |