summaryrefslogtreecommitdiff
path: root/jstests/multiVersion
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2014-10-08 19:05:09 -0400
committerMathias Stearn <mathias@10gen.com>2014-10-17 20:34:41 -0400
commit3c54ca1f58084845b7f778bde2f8a0f2138f727e (patch)
tree806c949b199ac596c38bd6a41e15984e04964825 /jstests/multiVersion
parent20de6ea8c790348b589acd737308eb853f230aa5 (diff)
downloadmongo-3c54ca1f58084845b7f778bde2f8a0f2138f727e.tar.gz
SERVER-15319 Multiversion test for freelist upgrade-downgrade
Diffstat (limited to 'jstests/multiVersion')
-rw-r--r--jstests/multiVersion/new_freelist_upgrade_downgrade.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/jstests/multiVersion/new_freelist_upgrade_downgrade.js b/jstests/multiVersion/new_freelist_upgrade_downgrade.js
new file mode 100644
index 00000000000..ff364baeb35
--- /dev/null
+++ b/jstests/multiVersion/new_freelist_upgrade_downgrade.js
@@ -0,0 +1,57 @@
+// SERVER-15319 Make sure pdfile version bumping for the new freelist works as intended
+
+var tooOld = "2.4"; // anything <= 2.6.4
+var newEnough = "2.6"; // latest in 2.6 is >= 2.6.5
+var latest = "latest";
+
+function restart(conn, version) {
+ MongoRunner.stopMongod(conn);
+ return MongoRunner.runMongod({restart: conn, remember: true, binVersion: version});
+}
+
+function repair(conn, version) {
+ MongoRunner.stopMongod(conn);
+ MongoRunner.runMongod({restart: conn, remember: true, binVersion: version, repair: ""});
+}
+
+
+// start out running tooOld
+var conn = MongoRunner.runMongod({ remember: true, binVersion: tooOld, smallfiles: "" });
+assert(conn);
+
+// can go from tooOld to newEnough
+conn = restart(conn, newEnough);
+assert(conn);
+
+// can go from newEnough to tooOld
+conn = restart(conn, tooOld);
+assert(conn);
+
+// can go from tooOld to latest
+conn = restart(conn, latest);
+assert(conn);
+
+// can go from latest to newEnough
+conn = restart(conn, newEnough);
+assert(conn);
+
+// can't go back to tooOld once started with latest, even if started with newEnough in between.
+assert.isnull(restart(conn, tooOld));
+
+// can still start with newEnough
+conn = restart(conn, newEnough);
+assert(conn);
+
+// can still start with latest
+conn = restart(conn, latest);
+assert(conn);
+
+// can repair with newEnough
+repair(conn, newEnough);
+
+// can start with tooOld after repairing with newEnough
+conn = restart(conn, tooOld);
+assert(conn);
+
+// THIS MUST BE THE LAST LINE
+MongoRunner.stopMongod(conn);