anmolnar commented on code in PR #2380:
URL: https://github.com/apache/zookeeper/pull/2380#discussion_r3191926802
##########
zookeeper-server/src/test/java/org/apache/zookeeper/common/X509UtilTest.java:
##########
@@ -873,4 +892,25 @@ private void
testCreateSSLContext_withWrongPasswordFromFile(final String keyPass
x509Util.getDefaultSSLContext();
});
}
+
+ @ParameterizedTest
+ @MethodSource("data")
+ @Timeout(value = 5)
+ public void testDefaultTlsProtocolWithInvalidDefaultTrustStore(
+ X509KeyType caKeyType, X509KeyType certKeyType, String
keyPassword, Integer paramIndex)
+ throws Exception {
+ init(caKeyType, certKeyType, keyPassword, paramIndex);
+ System.setProperty("javax.net.ssl.trustStore",
"/nonexistent/truststore.jks");
+ System.setProperty("javax.net.ssl.trustStorePassword", "bogus");
+ System.setProperty("javax.net.ssl.trustStoreType", "JKS");
+ try {
+ System.setProperty(FIPS_MODE_PROPERTY, Boolean.FALSE.toString());
+ String protocol = X509Util.defaultTlsProtocol(new ZKConfig());
+ assertTrue(TLS_1_2.equals(protocol) || TLS_1_3.equals(protocol));
+ } finally {
+ System.clearProperty("javax.net.ssl.trustStore");
+ System.clearProperty("javax.net.ssl.trustStorePassword");
+ System.clearProperty("javax.net.ssl.trustStoreType");
Review Comment:
I don't think we can implement a test like this. `SslContext.getDefault()`
will cache the problem and subsequent tests will fail even if the properties
are reverted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]