summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2017-06-05 17:43:06 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2017-06-08 10:19:22 -0400
commitadd06f168792ebb3751ba785860496a47475f977 (patch)
treee190340c83484d9b7ff5af03250eda3edc77b701 /jstests
parent60a4010587ed169a6f7e2709c150db2173e66514 (diff)
downloadmongo-add06f168792ebb3751ba785860496a47475f977.tar.gz
SERVER-29207 Add DateTimeSupport to ServiceContext
Adds a DateTimeSupport object attached to the global ServiceContext. This will eventually have support for many date manipulation functions, including support for working with different time zones.
Diffstat (limited to 'jstests')
-rw-r--r--jstests/aggregation/bugs/server7695_isodates.js2
-rw-r--r--jstests/libs/config_files/bad_timezone_info/InvalidVersionbin0 -> 170 bytes
-rw-r--r--jstests/libs/config_files/good_timezone_info/GMTbin0 -> 127 bytes
-rw-r--r--jstests/noPassthrough/parse_zone_info.js17
4 files changed, 18 insertions, 1 deletions
diff --git a/jstests/aggregation/bugs/server7695_isodates.js b/jstests/aggregation/bugs/server7695_isodates.js
index 194cb7f02c4..9c8077ecc32 100644
--- a/jstests/aggregation/bugs/server7695_isodates.js
+++ b/jstests/aggregation/bugs/server7695_isodates.js
@@ -33,7 +33,7 @@
return;
}
- assert.eq(res.cursor.firstBatch[0].result, expResult, pipeline);
+ assert.eq(res.cursor.firstBatch[0].result, expResult, tojson(pipeline));
}
// While development, there was a bug which caused an error with $dateToString if the order of
diff --git a/jstests/libs/config_files/bad_timezone_info/InvalidVersion b/jstests/libs/config_files/bad_timezone_info/InvalidVersion
new file mode 100644
index 00000000000..7a7af67f5c2
--- /dev/null
+++ b/jstests/libs/config_files/bad_timezone_info/InvalidVersion
Binary files differ
diff --git a/jstests/libs/config_files/good_timezone_info/GMT b/jstests/libs/config_files/good_timezone_info/GMT
new file mode 100644
index 00000000000..c05e45fddbb
--- /dev/null
+++ b/jstests/libs/config_files/good_timezone_info/GMT
Binary files differ
diff --git a/jstests/noPassthrough/parse_zone_info.js b/jstests/noPassthrough/parse_zone_info.js
new file mode 100644
index 00000000000..d17ac5d7986
--- /dev/null
+++ b/jstests/noPassthrough/parse_zone_info.js
@@ -0,0 +1,17 @@
+// Tests the parsing of the timeZoneInfo parameter.
+(function() {
+ // Test that a bad file causes startup to fail.
+ let conn = MongoRunner.runMongod({timeZoneInfo: "jstests/libs/config_files/bad_timezone_info"});
+ assert.eq(conn, null, "expected launching mongod with bad timezone rules to fail");
+ assert.neq(-1, rawMongoProgramOutput().indexOf("Fatal assertion 40474"));
+
+ // Test that a non-existent directory causes startup to fail.
+ conn = MongoRunner.runMongod({timeZoneInfo: "jstests/libs/config_files/missing_directory"});
+ assert.eq(conn, null, "expected launching mongod with bad timezone rules to fail");
+ assert.neq(-1, rawMongoProgramOutput().indexOf("Failed global initialization"));
+
+ // Test that startup can succeed with a good file.
+ conn = MongoRunner.runMongod({timeZoneInfo: "jstests/libs/config_files/good_timezone_info"});
+ assert.neq(conn, null, "expected launching mongod with good timezone rules to succeed");
+ MongoRunner.stopMongod(conn);
+}());