summaryrefslogtreecommitdiff
path: root/jstests/multiVersion/verify_versions_test.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/multiVersion/verify_versions_test.js')
-rw-r--r--jstests/multiVersion/verify_versions_test.js154
1 files changed, 77 insertions, 77 deletions
diff --git a/jstests/multiVersion/verify_versions_test.js b/jstests/multiVersion/verify_versions_test.js
index b1421d1c10e..e592f154f40 100644
--- a/jstests/multiVersion/verify_versions_test.js
+++ b/jstests/multiVersion/verify_versions_test.js
@@ -10,81 +10,81 @@
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
(function() {
- "use strict";
-
- function assertBinVersionsEqual(v1, v2) {
- assert(MongoRunner.areBinVersionsTheSame(v1, v2),
- "Expected \"" + v1 + "\" to equal \"" + v2 + "\"");
- }
-
- function assertBinVersionsNotEqual(v1, v2) {
- assert(!MongoRunner.areBinVersionsTheSame(v1, v2),
- "Expected \"" + v1 + "\" not to equal \"" + v2 + "\"");
- }
-
- function assertBinVersionComparesHigher(v1, v2) {
- assert.eq(1,
- MongoRunner.compareBinVersions(v1, v2),
- "Expected \"" + v1 + "\" to compare higher than \"" + v2 + "\"");
- }
-
- function assertBinVersionComparesLower(v1, v2) {
- assert.eq(-1,
- MongoRunner.compareBinVersions(v1, v2),
- "Expected \"" + v1 + "\" to compare lower than \"" + v2 + "\"");
- }
-
- function assertBinVersionComparesEqual(v1, v2) {
- assert.eq(0,
- MongoRunner.compareBinVersions(v1, v2),
- "Expected \"" + v1 + "\" to compare equal to \"" + v2 + "\"");
- }
-
- // The current version is in the 4.3 series. This has to be changed very time we bump
- // the major version pair, but it provides a useful test of assumptions.
- assertBinVersionsEqual("4.3", version());
- assertBinVersionComparesEqual("4.3", version());
-
- // "latest" is the same version as the shell, "last-stable" is not.
- assertBinVersionsEqual("latest", version());
- assertBinVersionsEqual("", "latest");
- assertBinVersionsEqual("", version());
-
- assertBinVersionComparesEqual("latest", version());
- assertBinVersionComparesEqual("", "latest");
- assertBinVersionComparesEqual("", version());
-
- assertBinVersionsNotEqual("latest", "last-stable");
- assertBinVersionsNotEqual("last-stable", version());
-
- assertBinVersionComparesHigher("latest", "last-stable");
- assertBinVersionComparesLower("last-stable", version());
-
- // 3.2 means 3.2.z for any value of z. It does not mean 3.0 or 3.0.w.
- assertBinVersionsEqual("3.2", "3.2.4");
- assertBinVersionsEqual("3.2.4", "3.2");
- assertBinVersionsNotEqual("3.2", "3.0");
- assertBinVersionsNotEqual("3.0.9", "3.2.9");
-
- assertBinVersionComparesEqual("3.2", "3.2.4");
- assertBinVersionComparesEqual("3.2.4", "3.2");
- assertBinVersionComparesHigher("3.2", "3.0");
- assertBinVersionComparesLower("3.0.9", "3.2.9");
-
- assertBinVersionsEqual("3.4", "3.4.0-abcd");
- assertBinVersionsEqual("3.4.0", "3.4.0-abcd");
-
- assertBinVersionComparesEqual("3.4", "3.4.0-abcd");
- assertBinVersionComparesEqual("3.4.0", "3.4.0-abcd");
- assertBinVersionComparesHigher("3.6.0", "3.4.0-abcd");
- assertBinVersionComparesHigher("4.0.0", "3.6.99-abcd");
- assertBinVersionComparesHigher("3.4.1", "3.4.0-abcd");
- assertBinVersionComparesLower("3.4.0-abc", "3.4.1-xyz");
-
- // Prohibit versions that don't have at least two components (3 is no good, 3.2 is).
- assert.throws(MongoRunner.areBinVersionsTheSame, ["3", "3.2"]);
- assert.throws(MongoRunner.areBinVersionsTheSame, ["3.2", "3"]);
-
- // Throw an error when versions differ only by githash.
- assert.throws(MongoRunner.compareBinVersions, ["3.4.1-abc", "3.4.1-xyz"]);
+"use strict";
+
+function assertBinVersionsEqual(v1, v2) {
+ assert(MongoRunner.areBinVersionsTheSame(v1, v2),
+ "Expected \"" + v1 + "\" to equal \"" + v2 + "\"");
+}
+
+function assertBinVersionsNotEqual(v1, v2) {
+ assert(!MongoRunner.areBinVersionsTheSame(v1, v2),
+ "Expected \"" + v1 + "\" not to equal \"" + v2 + "\"");
+}
+
+function assertBinVersionComparesHigher(v1, v2) {
+ assert.eq(1,
+ MongoRunner.compareBinVersions(v1, v2),
+ "Expected \"" + v1 + "\" to compare higher than \"" + v2 + "\"");
+}
+
+function assertBinVersionComparesLower(v1, v2) {
+ assert.eq(-1,
+ MongoRunner.compareBinVersions(v1, v2),
+ "Expected \"" + v1 + "\" to compare lower than \"" + v2 + "\"");
+}
+
+function assertBinVersionComparesEqual(v1, v2) {
+ assert.eq(0,
+ MongoRunner.compareBinVersions(v1, v2),
+ "Expected \"" + v1 + "\" to compare equal to \"" + v2 + "\"");
+}
+
+// The current version is in the 4.3 series. This has to be changed very time we bump
+// the major version pair, but it provides a useful test of assumptions.
+assertBinVersionsEqual("4.3", version());
+assertBinVersionComparesEqual("4.3", version());
+
+// "latest" is the same version as the shell, "last-stable" is not.
+assertBinVersionsEqual("latest", version());
+assertBinVersionsEqual("", "latest");
+assertBinVersionsEqual("", version());
+
+assertBinVersionComparesEqual("latest", version());
+assertBinVersionComparesEqual("", "latest");
+assertBinVersionComparesEqual("", version());
+
+assertBinVersionsNotEqual("latest", "last-stable");
+assertBinVersionsNotEqual("last-stable", version());
+
+assertBinVersionComparesHigher("latest", "last-stable");
+assertBinVersionComparesLower("last-stable", version());
+
+// 3.2 means 3.2.z for any value of z. It does not mean 3.0 or 3.0.w.
+assertBinVersionsEqual("3.2", "3.2.4");
+assertBinVersionsEqual("3.2.4", "3.2");
+assertBinVersionsNotEqual("3.2", "3.0");
+assertBinVersionsNotEqual("3.0.9", "3.2.9");
+
+assertBinVersionComparesEqual("3.2", "3.2.4");
+assertBinVersionComparesEqual("3.2.4", "3.2");
+assertBinVersionComparesHigher("3.2", "3.0");
+assertBinVersionComparesLower("3.0.9", "3.2.9");
+
+assertBinVersionsEqual("3.4", "3.4.0-abcd");
+assertBinVersionsEqual("3.4.0", "3.4.0-abcd");
+
+assertBinVersionComparesEqual("3.4", "3.4.0-abcd");
+assertBinVersionComparesEqual("3.4.0", "3.4.0-abcd");
+assertBinVersionComparesHigher("3.6.0", "3.4.0-abcd");
+assertBinVersionComparesHigher("4.0.0", "3.6.99-abcd");
+assertBinVersionComparesHigher("3.4.1", "3.4.0-abcd");
+assertBinVersionComparesLower("3.4.0-abc", "3.4.1-xyz");
+
+// Prohibit versions that don't have at least two components (3 is no good, 3.2 is).
+assert.throws(MongoRunner.areBinVersionsTheSame, ["3", "3.2"]);
+assert.throws(MongoRunner.areBinVersionsTheSame, ["3.2", "3"]);
+
+// Throw an error when versions differ only by githash.
+assert.throws(MongoRunner.compareBinVersions, ["3.4.1-abc", "3.4.1-xyz"]);
}());