David Handermann created NIFI-10989:
---------------------------------------

             Summary: Intermittent Failures in TestHashContent
                 Key: NIFI-10989
                 URL: https://issues.apache.org/jira/browse/NIFI-10989
             Project: Apache NiFi
          Issue Type: Bug
            Reporter: David Handermann
            Assignee: David Handermann


The {{TestHashContent.testSHA1}} method fails intermittently on GitHub 
automated builds, and also fails consistently when running as an individual 
test class with the following error:

{noformat}
Error:  Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.063 s 
<<< FAILURE! - in org.apache.nifi.processors.standard.TestHashContent
Error:  org.apache.nifi.processors.standard.TestHashContent.testSHA1  Time 
elapsed: 0.016 s  <<< FAILURE!
org.opentest4j.AssertionFailedError:
Processor has 1 validation failures:
'Hash Algorithm' validated against 'SHA-1' is invalid because Given value not 
found in allowed set 'SHA3-512, SHA-384, SHA, SHA3-384, SHA-224, SHA-512/256, 
SHA-256, MD2, SHA-512/224, SHA3-256, SHA-512, MD5, SHA3-224'
{noformat}

The problem is the result of {{Security.getAlgorithms("MessageDigest")}} 
returning different results in different scenarios. The standard JDK returns 
{{SHA}} but the Bouncy Castle Security Provider returns {{SHA-1}}. In some 
Maven builds, other classes invoke {{Security.addProvider(new 
BouncyCastleProvider())}} which changes the registered security providers for 
the entire Java Runtime. This allows the current test method to run 
successfully. In scenarios where the Bouncy Castle Provider is not registered, 
the test fails.

The {{HashContent}} Processor is deprecated in favor of 
{{CryptographicHashContent}} and will be removed in subsequent major releases. 
Although one solution would involve registering the Bouncy Castle Provider, 
removing the test method avoids intermittent failures and simplifies future 
maintenance with impending removal the Processor.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to