summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2017-03-02 14:07:32 -0500
committerGeert Bosch <geert@mongodb.com>2017-03-08 10:07:17 -0500
commit78052771af75f9c6fdff10796c82a38167274a6f (patch)
tree7fcfa87c45775dc86c86898501b2e06541ecd21b /src/mongo/dbtests
parent54f3fff857ac66be0cdca5a4ddce9f87a0d80e6a (diff)
downloadmongo-78052771af75f9c6fdff10796c82a38167274a6f.tar.gz
SERVER-27987 Create and persist UUIDs for newly created collections
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/querytests.cpp1
-rw-r--r--src/mongo/dbtests/rollbacktests.cpp61
2 files changed, 51 insertions, 11 deletions
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index b2b5495573e..83765c6ecd4 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -1318,6 +1318,7 @@ public:
ctx.db(),
ns(),
fromjson("{ capped : true, size : 2000, max: 10000 }"),
+ CollectionOptions::parseForCommand,
false)
.isOK());
wunit.commit();
diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp
index 27982080d36..d9e70651178 100644
--- a/src/mongo/dbtests/rollbacktests.cpp
+++ b/src/mongo/dbtests/rollbacktests.cpp
@@ -72,7 +72,8 @@ void createCollection(OperationContext* opCtx, const NamespaceString& nss) {
{
WriteUnitOfWork uow(opCtx);
ASSERT(!collectionExists(&ctx, nss.ns()));
- ASSERT_OK(userCreateNS(opCtx, ctx.db(), nss.ns(), BSONObj(), false));
+ ASSERT_OK(userCreateNS(
+ opCtx, ctx.db(), nss.ns(), BSONObj(), CollectionOptions::parseForCommand, false));
ASSERT(collectionExists(&ctx, nss.ns()));
uow.commit();
}
@@ -161,7 +162,8 @@ public:
WriteUnitOfWork uow(&opCtx);
ASSERT(!collectionExists(&ctx, ns));
auto options = capped ? BSON("capped" << true << "size" << 1000) : BSONObj();
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), ns, options, defaultIndexes));
+ ASSERT_OK(userCreateNS(
+ &opCtx, ctx.db(), ns, options, CollectionOptions::parseForCommand, defaultIndexes));
ASSERT(collectionExists(&ctx, ns));
if (!rollback) {
uow.commit();
@@ -192,7 +194,8 @@ public:
WriteUnitOfWork uow(&opCtx);
ASSERT(!collectionExists(&ctx, ns));
auto options = capped ? BSON("capped" << true << "size" << 1000) : BSONObj();
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), ns, options, defaultIndexes));
+ ASSERT_OK(userCreateNS(
+ &opCtx, ctx.db(), ns, options, CollectionOptions::parseForCommand, defaultIndexes));
uow.commit();
}
ASSERT(collectionExists(&ctx, ns));
@@ -236,7 +239,12 @@ public:
WriteUnitOfWork uow(&opCtx);
ASSERT(!collectionExists(&ctx, source.ns()));
ASSERT(!collectionExists(&ctx, target.ns()));
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), source.ns(), BSONObj(), defaultIndexes));
+ ASSERT_OK(userCreateNS(&opCtx,
+ ctx.db(),
+ source.ns(),
+ BSONObj(),
+ CollectionOptions::parseForCommand,
+ defaultIndexes));
uow.commit();
}
ASSERT(collectionExists(&ctx, source.ns()));
@@ -288,8 +296,18 @@ public:
WriteUnitOfWork uow(&opCtx);
ASSERT(!collectionExists(&ctx, source.ns()));
ASSERT(!collectionExists(&ctx, target.ns()));
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), source.ns(), BSONObj(), defaultIndexes));
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), target.ns(), BSONObj(), defaultIndexes));
+ ASSERT_OK(userCreateNS(&opCtx,
+ ctx.db(),
+ source.ns(),
+ BSONObj(),
+ CollectionOptions::parseForCommand,
+ defaultIndexes));
+ ASSERT_OK(userCreateNS(&opCtx,
+ ctx.db(),
+ target.ns(),
+ BSONObj(),
+ CollectionOptions::parseForCommand,
+ defaultIndexes));
insertRecord(&opCtx, source, sourceDoc);
insertRecord(&opCtx, target, targetDoc);
@@ -348,7 +366,12 @@ public:
{
WriteUnitOfWork uow(&opCtx);
ASSERT(!collectionExists(&ctx, nss.ns()));
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), nss.ns(), BSONObj(), defaultIndexes));
+ ASSERT_OK(userCreateNS(&opCtx,
+ ctx.db(),
+ nss.ns(),
+ BSONObj(),
+ CollectionOptions::parseForCommand,
+ defaultIndexes));
insertRecord(&opCtx, nss, oldDoc);
uow.commit();
}
@@ -361,7 +384,12 @@ public:
WriteUnitOfWork uow(&opCtx);
ASSERT_OK(ctx.db()->dropCollection(&opCtx, nss.ns()));
ASSERT(!collectionExists(&ctx, nss.ns()));
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), nss.ns(), BSONObj(), defaultIndexes));
+ ASSERT_OK(userCreateNS(&opCtx,
+ ctx.db(),
+ nss.ns(),
+ BSONObj(),
+ CollectionOptions::parseForCommand,
+ defaultIndexes));
ASSERT(collectionExists(&ctx, nss.ns()));
insertRecord(&opCtx, nss, newDoc);
assertOnlyRecord(&opCtx, nss, newDoc);
@@ -398,7 +426,12 @@ public:
{
WriteUnitOfWork uow(&opCtx);
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), nss.ns(), BSONObj(), defaultIndexes));
+ ASSERT_OK(userCreateNS(&opCtx,
+ ctx.db(),
+ nss.ns(),
+ BSONObj(),
+ CollectionOptions::parseForCommand,
+ defaultIndexes));
ASSERT(collectionExists(&ctx, nss.ns()));
insertRecord(&opCtx, nss, doc);
assertOnlyRecord(&opCtx, nss, doc);
@@ -434,7 +467,12 @@ public:
{
WriteUnitOfWork uow(&opCtx);
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), nss.ns(), BSONObj(), defaultIndexes));
+ ASSERT_OK(userCreateNS(&opCtx,
+ ctx.db(),
+ nss.ns(),
+ BSONObj(),
+ CollectionOptions::parseForCommand,
+ defaultIndexes));
ASSERT(collectionExists(&ctx, nss.ns()));
insertRecord(&opCtx, nss, doc);
assertOnlyRecord(&opCtx, nss, doc);
@@ -698,7 +736,8 @@ public:
{
WriteUnitOfWork uow(&opCtx);
ASSERT(!collectionExists(&ctx, nss.ns()));
- ASSERT_OK(userCreateNS(&opCtx, ctx.db(), nss.ns(), BSONObj(), false));
+ ASSERT_OK(userCreateNS(
+ &opCtx, ctx.db(), nss.ns(), BSONObj(), CollectionOptions::parseForCommand, false));
ASSERT(collectionExists(&ctx, nss.ns()));
Collection* coll = ctx.db()->getCollection(ns);
IndexCatalog* catalog = coll->getIndexCatalog();