diff options
author | Sergey Galtsev <sergey.galtsev@mongodb.com> | 2021-10-01 16:20:14 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-01 16:53:21 +0000 |
commit | 90083f91b3beac0a7d3966b5c3a1e9dbb3355504 (patch) | |
tree | ea934d29f6a0f80971ec827a4dbc58ce7da3a3eb | |
parent | d0df351c15cc61738ca821257390a303e5b4b3b5 (diff) | |
download | mongo-90083f91b3beac0a7d3966b5c3a1e9dbb3355504.tar.gz |
SERVER-60225 increase verbosity of mock OCSP responder
-rw-r--r-- | jstests/ocsp/lib/mock_ocsp.js | 15 | ||||
-rw-r--r-- | jstests/ocsp/lib/ocsp_mock.py | 19 |
2 files changed, 27 insertions, 7 deletions
diff --git a/jstests/ocsp/lib/mock_ocsp.js b/jstests/ocsp/lib/mock_ocsp.js index 9d8d166cb9f..d10edfbfc55 100644 --- a/jstests/ocsp/lib/mock_ocsp.js +++ b/jstests/ocsp/lib/mock_ocsp.js @@ -69,10 +69,11 @@ class MockOCSPServer { this.python, "-u", OCSP_PROGRAM, - "-p=" + this.port, + "--port=" + this.port, "--ca_file=" + this.ca_file, "--ocsp_responder_cert=" + this.ocsp_cert_file, "--ocsp_responder_key=" + this.ocsp_cert_key, + "--verbose", ]; if (this.fault_type) { @@ -113,6 +114,16 @@ class MockOCSPServer { * Stop the web server */ stop() { - stopMongoProgramByPid(this.pid); + if (!this.pid) { + print("Not stopping Mock OCSP Server, it was never started"); + return; + } + + print("Stopping Mock OCSP Server"); + + const kSIGINT = 2; + stopMongoProgramByPid(this.pid, kSIGINT); + + print("Mock OCSP Server stop complete"); } }
\ No newline at end of file diff --git a/jstests/ocsp/lib/ocsp_mock.py b/jstests/ocsp/lib/ocsp_mock.py index afc0ab4d074..519eed62963 100644 --- a/jstests/ocsp/lib/ocsp_mock.py +++ b/jstests/ocsp/lib/ocsp_mock.py @@ -4,7 +4,9 @@ Python script to interface as a mock OCSP responder. """ import argparse +import atexit import logging +import time import sys import os @@ -12,6 +14,12 @@ sys.path.append(os.path.join(os.getcwd() ,'src', 'third_party', 'mock_ocsp_respo import mock_ocsp_responder +logger = logging.getLogger(__name__) + +@atexit.register +def on_exit(): + logger.debug('Mock OCSP Responder is exiting') + def main(): """Main entry point""" parser = argparse.ArgumentParser(description="MongoDB Mock OCSP Responder.") @@ -35,15 +43,16 @@ def main(): parser.add_argument('--response_delay_seconds', type=int, default=0, help="Delays the response by this number of seconds") args = parser.parse_args() - if args.verbose: - logging.basicConfig(level=logging.DEBUG) - print('Initializing OCSP Responder') + level=logging.DEBUG if args.verbose else logging.INFO + logging.basicConfig(level=level, format="%(asctime)s %(levelname)s %(module)s: %(message)s") + logging.Formatter.converter = time.gmtime + + logger.info('Initializing OCSP Responder') 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, response_delay_seconds=args.response_delay_seconds) + logger.debug('Mock OCSP Responder will be started on port %s' % (str(args.port))) mock_ocsp_responder.init(port=args.port, debug=args.verbose, host=args.bind_ip) - print('Mock OCSP Responder is running on port %s' % (str(args.port))) - if __name__ == '__main__': main() |