diff options
author | samantharitter <samantha.ritter@10gen.com> | 2017-04-19 15:50:59 -0400 |
---|---|---|
committer | samantharitter <samantha.ritter@10gen.com> | 2017-04-20 15:04:20 -0400 |
commit | 89fb4cd00cda336d7915dd603ef802534a1c4ea7 (patch) | |
tree | 03829bc095af054c002f0fc8f8d3ba4efb19e862 /src/mongo/executor | |
parent | d4c16656d746c9e7a76579b593c41e48c915025d (diff) | |
download | mongo-89fb4cd00cda336d7915dd603ef802534a1c4ea7.tar.gz |
SERVER-28853 Properly test that host timeouts are delayed in connection_pool_test
Diffstat (limited to 'src/mongo/executor')
-rw-r--r-- | src/mongo/executor/connection_pool_test.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mongo/executor/connection_pool_test.cpp b/src/mongo/executor/connection_pool_test.cpp index a3b5cca24a8..22d7f5d93f3 100644 --- a/src/mongo/executor/connection_pool_test.cpp +++ b/src/mongo/executor/connection_pool_test.cpp @@ -813,8 +813,21 @@ TEST_F(ConnectionPoolTest, hostTimeoutHappensMoreGetsDelay) { }); ASSERT(reachedB); - // Now we've timed out - PoolImpl::setNow(now + Milliseconds(2000)); + // Now our timeout should be 1999 ms from 'now' instead of 1000 ms + // if we do another 'get' we should still get the original connection + PoolImpl::setNow(now + Milliseconds(1500)); + bool reachedB2 = false; + pool.get(HostAndPort(), + Milliseconds(5000), + [&](StatusWith<ConnectionPool::ConnectionHandle> swConn) { + ASSERT_EQ(connId, CONN2ID(swConn)); + reachedB2 = true; + doneWith(swConn.getValue()); + }); + ASSERT(reachedB2); + + // We should time out when we get to 'now' + 2500 ms + PoolImpl::setNow(now + Milliseconds(2500)); bool reachedC = false; // Different id |