adikou commented on code in PR #23914:
URL: https://github.com/apache/kafka/pull/23914#discussion_r4604804348


##########
clients/src/test/java/org/apache/kafka/common/security/ssl/DefaultSslEngineFactoryTest.java:
##########
@@ -334,8 +337,14 @@ public void testPemKeyStoreFileWithKeyPassword() throws 
Exception {
 
     @Test
     public void testUnavailableKeyFactoryAlgorithmDoesNotThrow() {
-        List<KeyFactory> factories = 
DefaultSslEngineFactory.PemStore.keyFactories(List.of("RSA", "DSA", "EC", 
"BOGUS_FACTORY"));
-        assertFalse(factories.stream().anyMatch(f -> 
f.getAlgorithm().equals("BOGUS_FACTORY")));
+        List<KeyFactory> factories = 
DefaultSslEngineFactory.PemStore.keyFactories(Set.of("BOGUS_FACTORY"));
+        assertTrue(factories.isEmpty());
+    }
+
+    @Test
+    public void testAllJvmKeyFactoryAlgorithmsLoaded() {
+        List<KeyFactory> factories = 
DefaultSslEngineFactory.PemStore.keyFactories(Security.getAlgorithms("KeyFactory"));

Review Comment:
   We're initialising `DefaultSslEngineFactory` with the same way as here in 
the test. If we change the main code or test, the other may drift even if the 
test succeeds. I was thinking we can instead assert that we we're actually able 
to load a KeyStore and avoid recreating `List<KeyFactory>` here.



-- 
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]

Reply via email to