summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp')
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
index 7322b3caf08..5993fb28eba 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
@@ -47,8 +47,11 @@ using unittest::assertGet;
using CommitChunkMigrate = ConfigServerTestFixture;
const NamespaceString kNamespace("TestDB.TestColl");
+const KeyPattern kKeyPattern(BSON("a" << 1));
TEST_F(CommitChunkMigrate, ChunksUpdatedCorrectlyWithControlChunk) {
+ const auto collUuid = UUID::gen();
+
ShardType shard0;
shard0.setName("shard0");
shard0.setHost("shard0:12");
@@ -81,7 +84,7 @@ TEST_F(CommitChunkMigrate, ChunksUpdatedCorrectlyWithControlChunk) {
controlChunk.setJumbo(true);
}
- setupChunks({migratedChunk, controlChunk});
+ setupCollection(migratedChunk.getNS(), collUuid, kKeyPattern, {migratedChunk, controlChunk});
Timestamp validAfter{101, 0};
BSONObj versions = assertGet(ShardingCatalogManager::get(operationContext())
@@ -129,6 +132,7 @@ TEST_F(CommitChunkMigrate, ChunksUpdatedCorrectlyWithControlChunk) {
}
TEST_F(CommitChunkMigrate, ChunksUpdatedCorrectlyWithoutControlChunk) {
+ const auto collUuid = UUID::gen();
ShardType shard0;
shard0.setName("shard0");
@@ -155,7 +159,7 @@ TEST_F(CommitChunkMigrate, ChunksUpdatedCorrectlyWithoutControlChunk) {
auto chunkMax = BSON("a" << 10);
chunk0.setMax(chunkMax);
- setupChunks({chunk0});
+ setupCollection(chunk0.getNS(), collUuid, kKeyPattern, {chunk0});
Timestamp validAfter{101, 0};
@@ -189,6 +193,7 @@ TEST_F(CommitChunkMigrate, ChunksUpdatedCorrectlyWithoutControlChunk) {
}
TEST_F(CommitChunkMigrate, CheckCorrectOpsCommandNoCtlTrimHistory) {
+ const auto collUuid = UUID::gen();
ShardType shard0;
shard0.setName("shard0");
@@ -215,7 +220,7 @@ TEST_F(CommitChunkMigrate, CheckCorrectOpsCommandNoCtlTrimHistory) {
auto chunkMax = BSON("a" << 10);
chunk0.setMax(chunkMax);
- setupChunks({chunk0});
+ setupCollection(chunk0.getNS(), collUuid, kKeyPattern, {chunk0});
// Make the time distance between the last history element large enough.
Timestamp validAfter{200, 0};
@@ -250,6 +255,7 @@ TEST_F(CommitChunkMigrate, CheckCorrectOpsCommandNoCtlTrimHistory) {
}
TEST_F(CommitChunkMigrate, RejectOutOfOrderHistory) {
+ const auto collUuid = UUID::gen();
ShardType shard0;
shard0.setName("shard0");
@@ -276,7 +282,7 @@ TEST_F(CommitChunkMigrate, RejectOutOfOrderHistory) {
auto chunkMax = BSON("a" << 10);
chunk0.setMax(chunkMax);
- setupChunks({chunk0});
+ setupCollection(chunk0.getNS(), collUuid, kKeyPattern, {chunk0});
// Make the time before the last change to trigger the failure.
Timestamp validAfter{99, 0};
@@ -294,6 +300,7 @@ TEST_F(CommitChunkMigrate, RejectOutOfOrderHistory) {
}
TEST_F(CommitChunkMigrate, RejectWrongCollectionEpoch0) {
+ const auto collUuid = UUID::gen();
ShardType shard0;
shard0.setName("shard0");
@@ -328,7 +335,7 @@ TEST_F(CommitChunkMigrate, RejectWrongCollectionEpoch0) {
auto chunkMaxax = BSON("a" << 20);
chunk1.setMax(chunkMaxax);
- setupChunks({chunk0, chunk1});
+ setupCollection(chunk0.getNS(), collUuid, kKeyPattern, {chunk0, chunk1});
Timestamp validAfter{1};
@@ -345,6 +352,7 @@ TEST_F(CommitChunkMigrate, RejectWrongCollectionEpoch0) {
}
TEST_F(CommitChunkMigrate, RejectWrongCollectionEpoch1) {
+ const auto collUuid = UUID::gen();
ShardType shard0;
shard0.setName("shard0");
@@ -381,7 +389,7 @@ TEST_F(CommitChunkMigrate, RejectWrongCollectionEpoch1) {
chunk1.setMax(chunkMaxax);
// get version from the control chunk this time
- setupChunks({chunk1, chunk0});
+ setupCollection(chunk0.getNS(), collUuid, kKeyPattern, {chunk1, chunk0});
Timestamp validAfter{1};
@@ -398,6 +406,7 @@ TEST_F(CommitChunkMigrate, RejectWrongCollectionEpoch1) {
}
TEST_F(CommitChunkMigrate, RejectChunkMissing0) {
+ const auto collUuid = UUID::gen();
ShardType shard0;
shard0.setName("shard0");
@@ -432,7 +441,7 @@ TEST_F(CommitChunkMigrate, RejectChunkMissing0) {
auto chunkMaxax = BSON("a" << 20);
chunk1.setMax(chunkMaxax);
- setupChunks({chunk1});
+ setupCollection(chunk1.getNS(), collUuid, kKeyPattern, {chunk1});
Timestamp validAfter{1};
@@ -449,6 +458,7 @@ TEST_F(CommitChunkMigrate, RejectChunkMissing0) {
}
TEST_F(CommitChunkMigrate, CommitWithLastChunkOnShardShouldNotAffectOtherChunks) {
+ const auto collUuid = UUID::gen();
ShardType shard0;
shard0.setName("shard0");
@@ -487,7 +497,7 @@ TEST_F(CommitChunkMigrate, CommitWithLastChunkOnShardShouldNotAffectOtherChunks)
Timestamp ctrlChunkValidAfter = Timestamp(50, 0);
chunk1.setHistory({ChunkHistory(ctrlChunkValidAfter, shard1.getName())});
- setupChunks({chunk0, chunk1});
+ setupCollection(chunk0.getNS(), collUuid, kKeyPattern, {chunk0, chunk1});
Timestamp validAfter{101, 0};
StatusWith<BSONObj> resultBSON = ShardingCatalogManager::get(operationContext())