summaryrefslogtreecommitdiff
path: root/jstests/ocsp/lib
diff options
context:
space:
mode:
authorShreyas Kalyan <shreyas.kalyan@10gen.com>2020-03-04 10:49:39 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-17 20:10:44 +0000
commit7072788923796e747370621abcd6cb10c381a828 (patch)
treeb429eeb29cf91e97660313da070ab6ff645031e4 /jstests/ocsp/lib
parent13caf3c499a22c2274bd533043eb7e06e6f8e8a4 (diff)
downloadmongo-7072788923796e747370621abcd6cb10c381a828.tar.gz
SERVER-46413 Add tests for OCSP on Windows and OSX
Diffstat (limited to 'jstests/ocsp/lib')
-rw-r--r--jstests/ocsp/lib/mock_ocsp.js8
-rw-r--r--jstests/ocsp/lib/ocsp_helpers.js13
-rw-r--r--jstests/ocsp/lib/ocsp_mock.py6
3 files changed, 21 insertions, 6 deletions
diff --git a/jstests/ocsp/lib/mock_ocsp.js b/jstests/ocsp/lib/mock_ocsp.js
index 40845ed2615..1cff413b531 100644
--- a/jstests/ocsp/lib/mock_ocsp.js
+++ b/jstests/ocsp/lib/mock_ocsp.js
@@ -56,15 +56,17 @@ class MockOCSPServer {
args.push("--next_update_seconds=" + this.next_update_secs);
}
+ clearRawMongoProgramOutput();
+
this.pid = _startMongoProgram({args: args});
assert(checkProgram(this.pid).alive);
assert.soon(function() {
- return rawMongoProgramOutput().search("Listening on") !== -1;
+ // Change this line if the OCSP endpoint changes
+ return rawMongoProgramOutput().search("Running on http://127.0.0.1:8100/") !== -1;
});
- sleep(1000);
- print("Mock OCSP Server successfully started");
+ sleep(2000);
}
/**
diff --git a/jstests/ocsp/lib/ocsp_helpers.js b/jstests/ocsp/lib/ocsp_helpers.js
index 4fdd447c126..8000d920584 100644
--- a/jstests/ocsp/lib/ocsp_helpers.js
+++ b/jstests/ocsp/lib/ocsp_helpers.js
@@ -10,3 +10,16 @@ const OCSP_CLIENT_CERT = "jstests/libs/ocsp/client_ocsp.pem";
const OCSP_SERVER_MUSTSTAPLE_CERT = "jstests/libs/ocsp/server_ocsp_mustStaple.pem";
const OCSP_RESPONDER_CERT = "jstests/libs/ocsp/ocsp_responder.crt";
const OCSP_RESPONDER_KEY = "jstests/libs/ocsp/ocsp_responder.key";
+
+var clearOCSPCache = function() {
+ let provider = determineSSLProvider();
+ if (provider === "apple") {
+ runMongoProgram("find",
+ "/private/var/folders/cl/",
+ "-regex",
+ "'.*\/C\/com.apple.trustd\/ocspcache.sqlite.*'",
+ "-delete");
+ } else if (provider === "windows") {
+ runMongoProgram("certutil", "-urlcache", "*", "delete");
+ }
+}; \ No newline at end of file
diff --git a/jstests/ocsp/lib/ocsp_mock.py b/jstests/ocsp/lib/ocsp_mock.py
index a1bc9af104c..04963b38559 100644
--- a/jstests/ocsp/lib/ocsp_mock.py
+++ b/jstests/ocsp/lib/ocsp_mock.py
@@ -35,12 +35,12 @@ def main():
logging.basicConfig(level=logging.DEBUG)
print('Initializing OCSP Responder')
- app = mock_ocsp_responder.OCSPResponder(issuer_cert=args.ca_file, responder_cert=args.ocsp_responder_cert, responder_key=args.ocsp_responder_key, fault=args.fault, next_update_seconds=args.next_update_seconds)
+ mock_ocsp_responder.init_responder(issuer_cert=args.ca_file, responder_cert=args.ocsp_responder_cert, responder_key=args.ocsp_responder_key, fault=args.fault, next_update_seconds=args.next_update_seconds)
if args.verbose:
- app.serve(args.port, debug=True)
+ mock_ocsp_responder.init(args.port, debug=True)
else:
- app.serve(args.port)
+ mock_ocsp_responder.init(args.port)
print('Mock OCSP Responder is running on port %s' % (str(args.port)))