From 6a13bdab4b65807884fe975d669ebf234b4fd6f2 Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Tue, 10 Dec 2013 15:19:50 -0500 Subject: SERVER-9074 Fix incorrect test cases in shard key immutability test --- jstests/sharding/shard_key_immutable.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'jstests/sharding') diff --git a/jstests/sharding/shard_key_immutable.js b/jstests/sharding/shard_key_immutable.js index 50f07bcadab..fbccc6fc809 100644 --- a/jstests/sharding/shard_key_immutable.js +++ b/jstests/sharding/shard_key_immutable.js @@ -401,17 +401,14 @@ doc = compoundColl.findOne(); 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 }); @@ -859,15 +856,12 @@ 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)); +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(doc == null, 'doc was upserted: ' + tojson(doc)); // // Dotted query update @@ -1053,7 +1047,7 @@ 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); -- cgit v1.2.1