diff options
Diffstat (limited to 'src/mongo/s/collection_metadata_test.cpp')
-rw-r--r-- | src/mongo/s/collection_metadata_test.cpp | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/src/mongo/s/collection_metadata_test.cpp b/src/mongo/s/collection_metadata_test.cpp index 2f5f19210a7..cb8bdfebc02 100644 --- a/src/mongo/s/collection_metadata_test.cpp +++ b/src/mongo/s/collection_metadata_test.cpp @@ -650,27 +650,24 @@ namespace { } TEST_F(SingleChunkFixture, SingleSplit) { - string errMsg; - ChunkType chunk; - scoped_ptr<CollectionMetadata> cloned; - - chunk.setMin( BSON("a" << 10) ); - chunk.setMax( BSON("a" << 20) ); - - vector<BSONObj> splitPoints; - splitPoints.push_back( BSON("a" << 14) ); - ChunkVersion version; - getCollMetadata().getCollVersion().cloneTo( &version ); + getCollMetadata().getCollVersion().cloneTo(&version); version.incMinor(); - cloned.reset( getCollMetadata().cloneSplit( chunk, - splitPoints, - version, - &errMsg ) ); + ChunkType chunk; + chunk.setMin(BSON("a" << 10)); + chunk.setMax(BSON("a" << 20)); - ASSERT_EQUALS( errMsg, "" ); - ASSERT( cloned != NULL ); + vector<BSONObj> splitPoints; + splitPoints.push_back(BSON("a" << 14)); + + string errMsg; + scoped_ptr<CollectionMetadata> cloned(getCollMetadata().cloneSplit(chunk, + splitPoints, + version, + &errMsg)); + ASSERT_EQUALS(errMsg, ""); + ASSERT(cloned != NULL); ChunkVersion newVersion( cloned->getCollVersion() ); ASSERT_EQUALS( version.epoch(), newVersion.epoch() ); @@ -681,12 +678,10 @@ namespace { ASSERT( chunk.getMin().woCompare( BSON("a" << 10) ) == 0 ); ASSERT( chunk.getMax().woCompare( BSON("a" << 14) ) == 0 ); - chunk.clear(); ASSERT( cloned->getNextChunk(BSON("a" << 14), &chunk) ); ASSERT( chunk.getMin().woCompare( BSON("a" << 14) ) == 0 ); ASSERT( chunk.getMax().woCompare( BSON("a" << 20) ) == 0 ); - chunk.clear(); ASSERT_FALSE( cloned->getNextChunk(BSON("a" << 20), &chunk) ); } @@ -719,22 +714,18 @@ namespace { ASSERT_EQUALS( version.majorVersion(), newVersion.majorVersion() ); ASSERT_EQUALS( version.minorVersion() + 2, newVersion.minorVersion() ); - chunk.clear(); ASSERT( cloned->getNextChunk(BSON("a" << MINKEY), &chunk) ); ASSERT( chunk.getMin().woCompare( BSON("a" << 10) ) == 0 ); ASSERT( chunk.getMax().woCompare( BSON("a" << 14) ) == 0 ); - chunk.clear(); ASSERT( cloned->getNextChunk(BSON("a" << 14), &chunk) ); ASSERT( chunk.getMin().woCompare( BSON("a" << 14) ) == 0 ); ASSERT( chunk.getMax().woCompare( BSON("a" << 16) ) == 0 ); - chunk.clear(); ASSERT( cloned->getNextChunk(BSON("a" << 16), &chunk) ); ASSERT( chunk.getMin().woCompare( BSON("a" << 16) ) == 0 ); ASSERT( chunk.getMax().woCompare( BSON("a" << 20) ) == 0 ); - chunk.clear(); ASSERT_FALSE( cloned->getNextChunk(BSON("a" << 20), &chunk) ); } |