diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-03-25 16:32:14 -0400 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-03-26 13:54:41 -0400 |
commit | ecb7f241ec7dc6739a582dcd011a7e9264734c56 (patch) | |
tree | 2f8be9b89d734a3e6ad81f83443c30e7d3225348 | |
parent | 04bb7c24cd09fd54470734f12fcd045f091d1314 (diff) | |
download | mongo-ecb7f241ec7dc6739a582dcd011a7e9264734c56.tar.gz |
SERVER-12127 Migrate js tests added recently
-rw-r--r-- | jstests/core/repair_server12955.js | 15 | ||||
-rw-r--r-- | jstests/core/update_server-12848.js | 20 |
2 files changed, 35 insertions, 0 deletions
diff --git a/jstests/core/repair_server12955.js b/jstests/core/repair_server12955.js new file mode 100644 index 00000000000..9582e4c7852 --- /dev/null +++ b/jstests/core/repair_server12955.js @@ -0,0 +1,15 @@ + +mydb = db.getSisterDB( "repair_server12955" ); +mydb.dropDatabase() + +mydb.foo.ensureIndex({a:"text"}) +mydb.foo.insert({a:"hello world"}) + +before = mydb.stats().dataFileVersion; + +mydb.repairDatabase(); + +after = mydb.stats().dataFileVersion; + +assert.eq( before, after ); +mydb.dropDatabase(); diff --git a/jstests/core/update_server-12848.js b/jstests/core/update_server-12848.js new file mode 100644 index 00000000000..f5ee9a8f2fa --- /dev/null +++ b/jstests/core/update_server-12848.js @@ -0,0 +1,20 @@ +// In SERVER-12848, it was shown that validation fails for certain types of updates +// because the validate code was attempting to validate field names in array. Mutable +// doesn't offer guarantees about the examined field name of array elements, only of the +// field name of array elements when serialized. This is a regression test to +// check that the new validation logic doesn't attempt to validate field names. + +var res; +var t = db.update_server_12848; +t.drop(); + +var orig = { "_id" : 1, "a" : [ 1, [ ] ] }; +res = t.insert(orig); +assert.writeOK(res, "insert"); +assert.eq(orig, t.findOne()); + +res = t.update({ "_id" : 1 }, { $addToSet : { "a.1" : 1 } }); +assert.writeOK(res, "update"); + +var updated = { "_id" : 1, "a" : [ 1, [ 1 ] ] }; +assert.eq(updated, t.findOne()); |