summaryrefslogtreecommitdiff
path: root/jstests/ssl/libs/ssl_helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/ssl/libs/ssl_helpers.js')
-rw-r--r--jstests/ssl/libs/ssl_helpers.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/jstests/ssl/libs/ssl_helpers.js b/jstests/ssl/libs/ssl_helpers.js
index 23703683aa4..05d0a5b9333 100644
--- a/jstests/ssl/libs/ssl_helpers.js
+++ b/jstests/ssl/libs/ssl_helpers.js
@@ -176,3 +176,34 @@ function mixedShardTest(options1, options2, shouldSucceed) {
}
}
}
+
+function determineSSLProvider() {
+ 'use strict';
+ const info = getBuildInfo();
+ const ssl = (info.openssl === undefined) ? '' : info.openssl.running;
+ if (/OpenSSL/.test(ssl)) {
+ return 'openssl';
+ } else if (/Apple/.test(ssl)) {
+ return 'apple';
+ } else if (/Windows/.test(ssl)) {
+ return 'windows';
+ } else {
+ return null;
+ }
+}
+
+function requireSSLProvider(required, fn) {
+ 'use strict';
+ if ((typeof required) === 'string') {
+ required = [required];
+ }
+
+ const provider = determineSSLProvider();
+ if (!required.includes(provider)) {
+ print("*****************************************************");
+ print("Skipping " + tojson(required) + " test because SSL provider is " + provider);
+ print("*****************************************************");
+ return;
+ }
+ fn();
+}