summaryrefslogtreecommitdiff
path: root/src/mongo/s/client/shard_local_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/client/shard_local_test.cpp')
-rw-r--r--src/mongo/s/client/shard_local_test.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/s/client/shard_local_test.cpp b/src/mongo/s/client/shard_local_test.cpp
index c667be3ccd0..80d1c12ff81 100644
--- a/src/mongo/s/client/shard_local_test.cpp
+++ b/src/mongo/s/client/shard_local_test.cpp
@@ -47,7 +47,7 @@ namespace {
class ShardLocalTest : public ServiceContextMongoDTest {
protected:
- ServiceContext::UniqueOperationContext _txn;
+ ServiceContext::UniqueOperationContext _opCtx;
std::unique_ptr<ShardLocal> _shardLocal;
/**
@@ -81,17 +81,17 @@ private:
void ShardLocalTest::setUp() {
ServiceContextMongoDTest::setUp();
Client::initThreadIfNotAlready();
- _txn = getGlobalServiceContext()->makeOperationContext(&cc());
+ _opCtx = getGlobalServiceContext()->makeOperationContext(&cc());
serverGlobalParams.clusterRole = ClusterRole::ConfigServer;
_shardLocal = stdx::make_unique<ShardLocal>(ShardId("config"));
const repl::ReplSettings replSettings = {};
repl::setGlobalReplicationCoordinator(
- new repl::ReplicationCoordinatorMock(_txn->getServiceContext(), replSettings));
+ new repl::ReplicationCoordinatorMock(_opCtx->getServiceContext(), replSettings));
repl::getGlobalReplicationCoordinator()->setFollowerMode(repl::MemberState::RS_PRIMARY);
}
void ShardLocalTest::tearDown() {
- _txn.reset();
+ _opCtx.reset();
ServiceContextMongoDTest::tearDown();
repl::setGlobalReplicationCoordinator(nullptr);
}
@@ -106,7 +106,7 @@ StatusWith<Shard::CommandResponse> ShardLocalTest::runFindAndModifyRunCommand(Na
WriteConcernOptions::kMajority, WriteConcernOptions::SyncMode::UNSET, Seconds(15)));
return _shardLocal->runCommandWithFixedRetryAttempts(
- _txn.get(),
+ _opCtx.get(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
nss.db().toString(),
findAndModifyRequest.toBSON(),
@@ -115,7 +115,7 @@ StatusWith<Shard::CommandResponse> ShardLocalTest::runFindAndModifyRunCommand(Na
StatusWith<std::vector<BSONObj>> ShardLocalTest::getIndexes(NamespaceString nss) {
auto response = _shardLocal->runCommandWithFixedRetryAttempts(
- _txn.get(),
+ _opCtx.get(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
nss.db().toString(),
BSON("listIndexes" << nss.coll().toString()),
@@ -148,7 +148,7 @@ StatusWith<Shard::QueryResponse> ShardLocalTest::runFindQuery(NamespaceString ns
BSONObj query,
BSONObj sort,
boost::optional<long long> limit) {
- return _shardLocal->exhaustiveFindOnConfig(_txn.get(),
+ return _shardLocal->exhaustiveFindOnConfig(_opCtx.get(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
repl::ReadConcernLevel::kMajorityReadConcern,
nss,
@@ -247,7 +247,7 @@ TEST_F(ShardLocalTest, CreateIndex) {
ASSERT_EQUALS(ErrorCodes::NamespaceNotFound, getIndexes(nss).getStatus());
Status status =
- _shardLocal->createIndexOnConfig(_txn.get(), nss, BSON("a" << 1 << "b" << 1), true);
+ _shardLocal->createIndexOnConfig(_opCtx.get(), nss, BSON("a" << 1 << "b" << 1), true);
// Creating the index should implicitly create the collection
ASSERT_OK(status);
@@ -256,13 +256,13 @@ TEST_F(ShardLocalTest, CreateIndex) {
ASSERT_EQ(2U, indexes.size());
// Making an identical index should be a no-op.
- status = _shardLocal->createIndexOnConfig(_txn.get(), nss, BSON("a" << 1 << "b" << 1), true);
+ status = _shardLocal->createIndexOnConfig(_opCtx.get(), nss, BSON("a" << 1 << "b" << 1), true);
ASSERT_OK(status);
indexes = unittest::assertGet(getIndexes(nss));
ASSERT_EQ(2U, indexes.size());
// Trying to make the same index as non-unique should fail.
- status = _shardLocal->createIndexOnConfig(_txn.get(), nss, BSON("a" << 1 << "b" << 1), false);
+ status = _shardLocal->createIndexOnConfig(_opCtx.get(), nss, BSON("a" << 1 << "b" << 1), false);
ASSERT_EQUALS(ErrorCodes::IndexOptionsConflict, status);
indexes = unittest::assertGet(getIndexes(nss));
ASSERT_EQ(2U, indexes.size());