Andy LoPresto created NIFI-7048:
-----------------------------------

             Summary: Unit tests should not fail if JAVA_HOME set incorrectly
                 Key: NIFI-7048
                 URL: https://issues.apache.org/jira/browse/NIFI-7048
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Tools and Build
    Affects Versions: 1.10.0
            Reporter: Andy LoPresto
            Assignee: Andy LoPresto


A number of users have had difficulty recently where {{SSLContextFactoryTest}} 
will fail due to an issue locating the JDK default {{cacerts}} truststore. This 
is usually caused by {{JAVA_HOME}} being improperly set. However, this issue 
was not present before the effort to support Java 11. During that time, the 
directory structure for Java <=8 and Java >=9 has changed, so there is logic to 
attempt to detect the version and build the correct path. 

Two improvements should be made:
1. The tests should include an {{Assume}} statement to skip execution if 
{{cacerts}} cannot be located
1. A clear error message (including the current value of {{JAVA_HOME}}) should 
be printed explaining the issue and providing instructions on how to resolve it

Example failing output: 

{code}
Some notes - I did run into a test failure (that I didn't have before) but
it was because JAVA_HOME was not set properly. I copy the error in case it
happens to someone else. This is on recently added tests:

[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed:
0.666 s <<< FAILURE! - in org.apache.nifi.io.socket.SSLContextFactoryTest
[ERROR]
testShouldVerifyKeystoreWithEmptyKeyPassword(org.apache.nifi.io.socket.SSLContextFactoryTest)
Time elapsed: 0.051 s  <<< ERROR!
java.io.FileNotFoundException: null/jre/lib/security/cacerts (No such file
or directory)
at
org.apache.nifi.io.socket.SSLContextFactoryTest.testShouldVerifyKeystoreWithEmptyKeyPassword(SSLContextFactoryTest.groovy:162)
[ERROR]
testShouldVerifyKeystoreWithDifferentKeyPassword(org.apache.nifi.io.socket.SSLContextFactoryTest)
Time elapsed: 0.002 s  <<< ERROR!
java.io.FileNotFoundException: null/jre/lib/security/cacerts (No such file
or directory)
at
org.apache.nifi.io.socket.SSLContextFactoryTest.testShouldVerifyKeystoreWithDifferentKeyPassword(SSLContextFactoryTest.groovy:138)
[ERROR]
testShouldVerifyKeystoreWithSameKeyPassword(org.apache.nifi.io.socket.SSLContextFactoryTest)
Time elapsed: 0.001 s  <<< ERROR!
java.io.FileNotFoundException: null/jre/lib/security/cacerts (No such file
or directory)
at
org.apache.nifi.io.socket.SSLContextFactoryTest.testShouldVerifyKeystoreWithSameKeyPassword(SSLContextFactoryTest.groovy:113)
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to