Skip to content
Browse files

SERVER-7379 re-enable tests in shard_key_immutable.js

  • Loading branch information...
1 parent 32b3621 commit f4c7d400c8f938374474a37cde54e36168e60b26 @dstorch dstorch committed Feb 25, 2014
Showing with 4 additions and 34 deletions.
  1. +4 −34 jstests/sharding/shard_key_immutable.js
View
38 jstests/sharding/shard_key_immutable.js
@@ -98,7 +98,6 @@ doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-/*
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
compoundColl.update({}, { $set: { a: 100, b: 100 }}, false, true);
@@ -107,7 +106,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
// Cannot modify _id
compoundColl.remove({}, false);
@@ -236,7 +234,6 @@ doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-/*
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
compoundColl.update({ a: 100 }, { $set: { a: 100 }}, false, true);
@@ -245,7 +242,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
@@ -257,7 +253,6 @@ delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
// Inspecting query and update alone is not enough to tell whether a shard key will change.
-/*
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
compoundColl.update({ a: 100 }, { $set: { b: 100 }}, false, true);
@@ -266,7 +261,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
@@ -278,7 +272,6 @@ delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
// Inspecting query and update alone is not enough to tell whether a shard key will change.
-/*
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
compoundColl.update({ a: 100 }, { $set: { a: 100, b: 100 }}, false, true);
@@ -287,7 +280,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
// Cannot modify _id!
compoundColl.remove({}, false);
@@ -425,16 +417,14 @@ delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
// Inspecting query and update alone is not enough to tell whether a shard key will change.
-/*
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
compoundColl.update({ b: 100 }, { a: 100 }, false);
gle = db.runCommand({ getLastError: 1 });
-assert(gle.err == null, 'gleObj: ' + tojson(gle));
+assert(gle.err != null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
@@ -483,7 +473,6 @@ doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-/*
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
compoundColl.update({ b: 100 }, { $set: { a: 100 }}, false, true);
@@ -492,7 +481,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
@@ -504,7 +492,6 @@ delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
// Inspecting query and update alone is not enough to tell whether a shard key will change.
-/*
compoundColl.remove({}, false);
compoundColl.insert({ a: 100, b: 100 });
compoundColl.update({ b: 100 }, { $set: { a: 100, b: 100 }}, false, true);
@@ -513,7 +500,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
// Cannot modify _id!
compoundColl.remove({}, false);
@@ -809,7 +795,6 @@ doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-/*
compoundColl.remove({}, false);
compoundColl.insert({ _id: 1, a: 100, b: 100 });
compoundColl.update({ _id: 1 }, { $set: { a: 100 }}, false, true);
@@ -818,7 +803,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
compoundColl.remove({}, false);
compoundColl.insert({ _id: 1, a: 100, b: 100 });
@@ -829,7 +813,6 @@ doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-/*
compoundColl.remove({}, false);
compoundColl.insert({ _id: 1, a: 100, b: 100 });
compoundColl.update({ _id: 1 }, { $set: { b: 100 }}, false, true);
@@ -838,7 +821,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { a: 100, b: 100 }), 'doc changed: ' + tojson(doc));
-*/
compoundColl.remove({}, false);
compoundColl.insert({ _id: 1, a: 100, b: 100 });
@@ -882,15 +864,11 @@ assert(gle.err != null, 'gleObj: ' + tojson(gle));
doc = compoundColl.findOne();
assert(doc == null, 'doc was upserted: ' + tojson(doc));
-/*
compoundColl.remove({}, false);
compoundColl.update({ _id: 1 }, { $set: { a: 1, b: 1 }}, true, true);
gle = db.runCommand({ getLastError: 1 });
-assert(gle.err == null, 'gleObj: ' + tojson(gle));
-doc = compoundColl.findOne();
-delete doc._id;
-assert(friendlyEqual(doc, { a: 1, b: 1 }), 'bad doc: ' + tojson(doc));
-*/
+assert(gle.err != null, 'gleObj: ' + tojson(gle));
+assert.eq(0, compoundColl.count(), 'doc should not be inserted');
//
// Dotted query update
@@ -947,7 +925,6 @@ doc = dotColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { x: { a: 100 }}), 'doc changed: ' + tojson(doc));
-/*
dotColl.remove({}, false);
dotColl.insert({ x: { a: 100 }});
dotColl.update({ 'x.a': 100 }, { $set: { x: { a: 100, b: 2 }}}, false, true);
@@ -956,7 +933,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = dotColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { x: { a: 100, b: 2 }}), 'doc did not change: ' + tojson(doc));
-*/
dotColl.remove({}, false);
dotColl.insert({ x: { a: 100 }});
@@ -976,7 +952,6 @@ doc = dotColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { x: { a: 100 }}), 'doc changed: ' + tojson(doc));
-/*
dotColl.remove({}, false);
dotColl.insert({ x: { a: 100 }});
dotColl.update({ 'x.a': 100 }, { $set: { 'x.a': 100, b: 2 }}, false, true);
@@ -985,7 +960,6 @@ assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = dotColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { x: { a: 100 }, b: 2 }), 'doc did not change: ' + tojson(doc));
-*/
dotColl.remove({}, false);
dotColl.insert({ x: { a: 100 }});
@@ -1069,15 +1043,13 @@ assert(gle.err != null, 'gleObj: ' + tojson(gle));
doc = dotColl.findOne();
assert(doc == null, 'doc was upserted: ' + tojson(doc));
-/*
dotColl.remove({}, false);
dotColl.update({ 'x.a': 100 }, { $set: { x: { a: 100, b: 2 }}}, true);
gle = db.runCommand({ getLastError: 1 });
assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = dotColl.findOne();
delete doc._id;
-assert(friendlyEqual(doc, { x: { a: 100, 2: 3 }}), 'bad doc: ' + tojson(doc));
-*/
+assert(friendlyEqual(doc, { x: { a: 100, b: 2 }}), 'bad doc: ' + tojson(doc));
dotColl.remove({}, false);
dotColl.update({ 'x.a': 100 }, { $set: { x: { a: 2 }}}, true);
@@ -1093,15 +1065,13 @@ assert(gle.err != null, 'gleObj: ' + tojson(gle));
doc = dotColl.findOne();
assert(doc == null, 'doc was upserted: ' + tojson(doc));
-/*
dotColl.remove({}, false);
dotColl.update({ 'x.a': 100 }, { $set: { 'x.a': 100, b: 3 }}, true);
gle = db.runCommand({ getLastError: 1 });
assert(gle.err == null, 'gleObj: ' + tojson(gle));
doc = dotColl.findOne();
delete doc._id;
assert(friendlyEqual(doc, { x: { a: 100 }, b: 3 }), 'bad doc: ' + tojson(doc));
-*/
dotColl.remove({}, false);
dotColl.update({ 'x.a': 100 }, { $set: { 'x.a': 2 }}, true);

0 comments on commit f4c7d40

Please sign in to comment.
Something went wrong with that request. Please try again.