summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShreyas Kalyan <shreyas.kalyan@10gen.com>2020-05-13 11:24:50 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-20 20:13:40 +0000
commit675884128ee61da36b910050153861278f42e8cb (patch)
treed0821290c021b7beb27bee4fa395b5a088f9930d
parent64d1fbcfd7f9a4b29c6df9a0c10bdc4607df1d7e (diff)
downloadmongo-675884128ee61da36b910050153861278f42e8cb.tar.gz
SERVER-47964 Add OCSP Sharding tests
-rw-r--r--jstests/ocsp/ocsp_sharding_basic.js86
1 files changed, 86 insertions, 0 deletions
diff --git a/jstests/ocsp/ocsp_sharding_basic.js b/jstests/ocsp/ocsp_sharding_basic.js
new file mode 100644
index 00000000000..e7f6cb8f4e4
--- /dev/null
+++ b/jstests/ocsp/ocsp_sharding_basic.js
@@ -0,0 +1,86 @@
+// Check that OCSP verification works
+// @tags: [requires_http_client]
+
+load("jstests/ocsp/lib/mock_ocsp.js");
+
+(function() {
+"use strict";
+
+if (determineSSLProvider() === "apple") {
+ return;
+}
+
+const ocsp_options = {
+ sslMode: "requireSSL",
+ sslPEMKeyFile: OCSP_SERVER_CERT,
+ sslCAFile: OCSP_CA_CERT,
+ sslAllowInvalidHostnames: "",
+};
+
+const sharding_config = {
+ shards: 1,
+ mongos: 1,
+ other: {
+ configOptions: ocsp_options,
+ mongosOptions: ocsp_options,
+ rsOptions: ocsp_options,
+ shardOptions: ocsp_options,
+ }
+};
+
+function test() {
+ assert.doesNotThrow(() => {
+ let st = new ShardingTest(sharding_config);
+
+ st.getConnNames();
+ st.stop();
+ });
+}
+
+clearOCSPCache();
+
+test();
+
+let mock_ocsp = new MockOCSPServer("", 1000);
+mock_ocsp.start();
+
+clearOCSPCache();
+
+test();
+
+mock_ocsp.stop();
+
+// We don't want to invoke the hang analyzer because we
+// expect this test to fail by timing out
+MongoRunner.runHangAnalyzer.disable();
+
+clearOCSPCache();
+
+var st = new ShardingTest(sharding_config);
+
+mock_ocsp = new MockOCSPServer(FAULT_REVOKED, 1);
+mock_ocsp.start();
+
+const err = assert.throws(() => {
+ st.restartMongos(0);
+});
+
+mock_ocsp.stop();
+
+const errMsg = err.toString();
+
+assert.gte(errMsg.search("assert.soon failed"), 0, "Test failed for wrong reason: " + err);
+
+sleep(2000);
+
+MongoRunner.runHangAnalyzer.enable();
+
+mock_ocsp = new MockOCSPServer("", 1000);
+mock_ocsp.start();
+
+// Get the mongos back up again so that we can shutdown the ShardingTest.
+st.restartMongos(0);
+
+mock_ocsp.stop();
+st.stop();
+}()); \ No newline at end of file