Github user sohami commented on a diff in the pull request:

    https://github.com/apache/drill/pull/950#discussion_r140588134
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/exec/TestSSLConfig.java ---
    @@ -91,10 +123,35 @@ public void testForTrustStore() throws Exception {
         ConfigBuilder config = new ConfigBuilder();
         config.put(ExecConstants.HTTP_TRUSTSTORE_PATH, "/root");
         config.put(ExecConstants.HTTP_TRUSTSTORE_PASSWORD, "root");
    -    SSLConfig sslv = new SSLConfig(config.build());
    +    config.put(ExecConstants.SSL_USE_HADOOP_CONF, false);
    +    SSLConfig sslv = new SSLConfigBuilder()
    +        .config(config.build())
    +        .mode(SSLFactory.Mode.SERVER)
    +        .initializeSSLContext(false)
    +        .validateKeyStore(true)
    +        .build();
         assertEquals(true, sslv.hasTrustStorePath());
         assertEquals(true,sslv.hasTrustStorePassword());
         assertEquals("/root",sslv.getTrustStorePath());
         assertEquals("root",sslv.getTrustStorePassword());
       }
    -}
    \ No newline at end of file
    +
    +  @Test
    +  public void testInvalidHadoopKeystore() throws Exception {
    +    Configuration hadoopConfig = new Configuration();
    +    String hadoopSSLFileProp = MessageFormat
    +        .format(HADOOP_SSL_CONF_TPL_KEY, 
SSLFactory.Mode.SERVER.toString().toLowerCase());
    +    hadoopConfig.set(hadoopSSLFileProp, "ssl-server-invalid.xml");
    +    ConfigBuilder config = new ConfigBuilder();
    +    config.put(ExecConstants.SSL_USE_HADOOP_CONF, true);
    +    SSLConfig sslv = new SSLConfigBuilder()
    +        .config(config.build())
    +        .mode(SSLFactory.Mode.SERVER)
    +        .initializeSSLContext(false)
    +        .validateKeyStore(true)
    +        .hadoopConfig(hadoopConfig)
    +        .build();
    +    assertEquals("FAIL", sslv.getKeyStorePassword());
    --- End diff --
    
    Shouldn't this test fail while doing `validateKeyStore` since there is no 
keystore path but only password in the hadoop config file ?


---

Reply via email to