diff options
author | Samantha Ritter <samantha.ritter@10gen.com> | 2016-05-31 14:05:17 -0400 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2016-07-12 18:38:37 -0400 |
commit | c263ce1f95586f8652058e6202015a77f9becc49 (patch) | |
tree | d623fb9da9fd5da3cc4e20cac0653f1fa4af00eb /src/mongo/s/sharding_test_fixture.cpp | |
parent | dead3cf8b4b3cb5528ad1abb9eeb722b395e3632 (diff) | |
download | mongo-c263ce1f95586f8652058e6202015a77f9becc49.tar.gz |
SERVER-24162 Integrate TransportLayer
Expand the transport layer as needed to replace uses of abstract message port for ingress
networking.
Diffstat (limited to 'src/mongo/s/sharding_test_fixture.cpp')
-rw-r--r-- | src/mongo/s/sharding_test_fixture.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/s/sharding_test_fixture.cpp b/src/mongo/s/sharding_test_fixture.cpp index 5d8c3e2285e..f099ac2e67b 100644 --- a/src/mongo/s/sharding_test_fixture.cpp +++ b/src/mongo/s/sharding_test_fixture.cpp @@ -65,6 +65,8 @@ #include "mongo/s/write_ops/batched_command_request.h" #include "mongo/s/write_ops/batched_command_response.h" #include "mongo/stdx/memory.h" +#include "mongo/transport/transport_layer.h" +#include "mongo/transport/transport_layer_mock.h" #include "mongo/util/clock_source_mock.h" #include "mongo/util/tick_source_mock.h" @@ -92,8 +94,12 @@ void ShardingTestFixture::setUp() { _service->setFastClockSource(stdx::make_unique<ClockSourceMock>()); _service->setPreciseClockSource(stdx::make_unique<ClockSourceMock>()); _service->setTickSource(stdx::make_unique<TickSourceMock>()); - _messagePort = stdx::make_unique<MessagingPortMock>(); - _client = _service->makeClient("ShardingTestFixture", _messagePort.get()); + auto tlMock = stdx::make_unique<transport::TransportLayerMock>(); + _transportLayer = tlMock.get(); + _service->addAndStartTransportLayer(std::move(tlMock)); + _transportSession = + stdx::make_unique<transport::Session>(HostAndPort{}, HostAndPort{}, _transportLayer); + _client = _service->makeClient("ShardingTestFixture", _transportSession.get()); _opCtx = _client->makeOperationContext(); // Set up executor pool used for most operations. @@ -184,6 +190,7 @@ void ShardingTestFixture::tearDown() { grid.catalogClient(_opCtx.get())->shutDown(_opCtx.get()); grid.clearForUnitTests(); + _transportSession.reset(); _opCtx.reset(); _client.reset(); _service.reset(); @@ -238,10 +245,6 @@ executor::TaskExecutor* ShardingTestFixture::executor() const { return _executor; } -MessagingPortMock* ShardingTestFixture::getMessagingPort() const { - return _messagePort.get(); -} - DistLockManagerMock* ShardingTestFixture::distLock() const { invariant(_distLockManager); return _distLockManager; @@ -508,6 +511,10 @@ void ShardingTestFixture::expectCount(const HostAndPort& configHost, }); } +void ShardingTestFixture::setRemote(const HostAndPort& remote) { + *_transportSession = transport::Session{remote, HostAndPort{}, _transportLayer}; +} + void ShardingTestFixture::checkReadConcern(const BSONObj& cmdObj, const Timestamp& expectedTS, long long expectedTerm) const { |