From 0afe00a0d57043c2f31594316a36ecea54601aca Mon Sep 17 00:00:00 2001 From: Dwight Date: Thu, 17 Nov 2011 14:07:37 -0500 Subject: [PATCH] test more --- jstests/compact.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/jstests/compact.js b/jstests/compact.js index ea3732a2f39..91b85872637 100644 --- a/jstests/compact.js +++ b/jstests/compact.js @@ -35,6 +35,31 @@ assert(v.ok); assert(t.stats().storageSize > ssize, "expected more storage given padding is higher. however it rounds off so if something changed this could be"); //printjson(t.stats()); +print("z"); + +t.insert({ x: 4, z: 2, k: { a: "", b: ""} }); +t.insert({ x: 4, z: 2, k: { a: "", b: ""} }); +t.insert({ x: 4, z: 2, k: { a: "", b: ""} }); +t.insert({ x: 4, z: 2, k: { a: "", b: ""} }); +t.insert({ x: 4, z: null, k: { a: "", b: ""} }); +t.insert({ x: 4, z: null, k: { c: ""} }); +t.insert({ x: 4, z: null }); +t.insert({ x: 4, z: 3}); +t.insert({ x: 4, z: 2, k: { a: "", b: ""} }); +t.insert({ x: 4, z: null, k: { c: ""} }); +t.insert({ x: 4, z: null, k: { c: ""} }); +t.insert({ x: 4, z: 3, k: { c: ""} }); + +t.ensureIndex({ z: 1, k: 1 }); +//t.ensureIndex({ z: 1, k: 1 }, { unique: true }); +//t.ensureIndex({ z: 1, k: 1 }, { dropDups: true, unique:true }); + +res = db.runCommand({ compact: 'compacttest', dev: true, paddingFactor: 1.2 }); +assert(res.ok); +assert(t.count() > 13); +var v = t.validate(true); +assert(v.ok); + print("3"); // works on an empty collection? @@ -44,4 +69,5 @@ assert(t.count() == 0); v = t.validate(true); assert(v.ok); assert(v.extentCount == 1); -assert(t.getIndexes().length == 2); +assert(t.getIndexes().length == 3); +