You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/08/24 14:28:49 UTC

[GitHub] [nifi] MikeThomsen opened a new pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

MikeThomsen opened a new pull request #5332:
URL: https://github.com/apache/nifi/pull/5332


   <!--
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at
         http://www.apache.org/licenses/LICENSE-2.0
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
   -->
   Thank you for submitting a contribution to Apache NiFi.
   
   Please provide a short description of the PR here:
   
   #### Description of PR
   
   _Enables X functionality; fixes bug NIFI-YYYY._
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [ ] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [ ] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### For code changes:
   - [ ] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [ ] Have you verified that the full build is successful on JDK 8?
   - [ ] Have you verified that the full build is successful on JDK 11?
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
   - [ ] If applicable, have you updated the `LICENSE` file, including the main `LICENSE` file under `nifi-assembly`?
   - [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
   - [ ] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r725261880



##########
File path: nifi-commons/nifi-record-path/src/test/java/org/apache/nifi/record/path/TestRecordPath.java
##########
@@ -1820,10 +1817,12 @@ public void testHash() {
         assertEquals("5753a498f025464d72e088a9d5d6e872592d5f91", RecordPath.compile("hash(/firstName, 'SHA-1')").evaluate(record).getSelectedFields().findFirst().get().getValue());
     }
 
-    @Test(expected = RecordPathException.class)
+    @Test
     public void testHashFailure() {
         final Record record = getCaseTestRecord();
-        assertEquals("61409aa1fd47d4a5332de23cbf59a36f", RecordPath.compile("hash(/firstName, 'NOT_A_ALGO')").evaluate(record).getSelectedFields().findFirst().get().getValue());
+        //assertEquals("61409aa1fd47d4a5332de23cbf59a36f", RecordPath.compile("hash(/firstName, 'NOT_A_ALGO')").evaluate(record).getSelectedFields().findFirst().get().getValue());

Review comment:
       Is there a reason why this was commented out?

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/BcryptCipherProviderGroovyTest.groovy
##########
@@ -610,7 +596,7 @@ class BcryptCipherProviderGroovyTest {
         assert decryptMsg =~ "The salt must be of the format"
     }
 
-    @Ignore("This test can be run on a specific machine to evaluate if the default work factor is sufficient")
+    @Disabled("This test can be run on a specific machine to evaluate if the default work factor is sufficient")

Review comment:
       This should be enabled using a conditional property.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/PBKDF2CipherProviderGroovyTest.groovy
##########
@@ -164,8 +155,8 @@ class PBKDF2CipherProviderGroovyTest {
     @Test
     void testGetCipherWithUnlimitedStrengthShouldBeInternallyConsistent() throws Exception {
         // Arrange
-        Assume.assumeTrue("Test is being skipped due to this JVM lacking JCE Unlimited Strength Jurisdiction Policy file.",
-                CipherUtility.isUnlimitedStrengthCryptoSupported())
+        assumeTrue(CipherUtility.isUnlimitedStrengthCryptoSupported(),
+                "Test is being skipped due to this JVM lacking JCE Unlimited Strength Jurisdiction Policy file.")

Review comment:
       This can be removed.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/ScryptSecureHasherTest.groovy
##########
@@ -239,7 +252,7 @@ class ScryptSecureHasherTest extends GroovyTestCase {
      * This test can have the minimum time threshold updated to determine if the performance
      * is still sufficient compared to the existing threat model.
      */
-    @Ignore("Long running test")
+    @Disabled("Long running test")

Review comment:
       Enabled on system property.

##########
File path: nifi-commons/nifi-record/pom.xml
##########
@@ -28,4 +28,12 @@
         on any external libraries.
     </description>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-junit-jupiter</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+

Review comment:
       Is this dependency necessary?

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/PBKDF2SecureHasherTest.groovy
##########
@@ -242,7 +249,7 @@ class PBKDF2SecureHasherTest extends GroovyTestCase {
      * This test can have the minimum time threshold updated to determine if the performance
      * is still sufficient compared to the existing threat model.
      */
-    @Ignore("Long running test")
+    @Disabled("Long running test")

Review comment:
       Enabled on system property.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/HashServiceTest.groovy
##########
@@ -428,9 +402,9 @@ class HashServiceTest extends GroovyTestCase {
         // Act
         def generatedHashes = algorithms.collectEntries { HashAlgorithm algorithm ->
             // Get a new InputStream for each iteration, or it will calculate the hash of an empty input on iterations 1 - n
-            InputStream input = inputFile.newInputStream()
+            InputStream input = new ByteArrayInputStream(sb.toString().bytes)
             String hash = HashService.hashValueStreaming(algorithm, input)
-            logger.info("${algorithm.getName().padLeft(11)}(${inputFile.path}) [${hash.length() / 2}] = ${hash}")
+//            logger.info("${algorithm.getName().padLeft(11)}(${inputFile.path}) [${hash.length() / 2}] = ${hash}")

Review comment:
       This log line should be removed

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/Argon2SecureHasherTest.groovy
##########
@@ -46,30 +43,35 @@ class Argon2SecureHasherTest extends GroovyTestCase {
         Hex.decode(hex?.replaceAll("[^0-9a-fA-F]", ""))
     }
 
-    @Ignore("Cannot override static salt")
+    @Disabled("Cannot override static salt")
     @Test
     void testShouldMatchReferenceVectors() {
-        // Arrange
-        int hashLength = 32
-        int memory = 32
-        int parallelism = 4
-        int iterations = 3
-        logger.info("Generating Argon2 hash for hash length: ${hashLength} B, mem: ${memory} KiB, parallelism: ${parallelism}, iterations: ${iterations}")
-
-        Argon2SecureHasher a2sh = new Argon2SecureHasher(hashLength, memory, parallelism, iterations)
-        // Override the static salt for the published test vector
-//        a2sh.staticSalt = [0x02] * 16
-
-        // Act
-        byte[] hash = a2sh.hashRaw([0x01] * 32 as byte[])
-        logger.info("Generated hash: ${Hex.encode(hash)}")
-
-        // Assert
-        assert hash == decodeHex("0d 64 0d f5 8d 78 76 6c 08 c0 37 a3 4a 8b 53 c9 d0 " +
-                "1e f0 45 2d 75 b6 5e b5 25 20 e9 6b 01 e6 59")
-
-        // Clean up
-//        Argon2SecureHasher.staticSalt = "NiFi Static Salt".bytes
+        /*
+         * TODO: Fix?
+         * Commented out because surefire is ignoring @Disabled
+         */
+
+//        // Arrange
+//        int hashLength = 32
+//        int memory = 32
+//        int parallelism = 4
+//        int iterations = 3
+//        logger.info("Generating Argon2 hash for hash length: ${hashLength} B, mem: ${memory} KiB, parallelism: ${parallelism}, iterations: ${iterations}")
+//
+//        Argon2SecureHasher a2sh = new Argon2SecureHasher(hashLength, memory, parallelism, iterations)
+//        // Override the static salt for the published test vector
+////        a2sh.staticSalt = [0x02] * 16
+//
+//        // Act
+//        byte[] hash = a2sh.hashRaw([0x01] * 32 as byte[])
+//        logger.info("Generated hash: ${Hex.encode(hash)}")
+//
+//        // Assert
+//        assert hash == decodeHex("0d 64 0d f5 8d 78 76 6c 08 c0 37 a3 4a 8b 53 c9 d0 " +
+//                "1e f0 45 2d 75 b6 5e b5 25 20 e9 6b 01 e6 59")
+//
+//        // Clean up
+////        Argon2SecureHasher.staticSalt = "NiFi Static Salt".bytes

Review comment:
       These commented lines should be corrected, or perhaps removed if that test method is unreliable.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/BcryptSecureHasherTest.groovy
##########
@@ -263,7 +250,7 @@ class BcryptSecureHasherTest extends GroovyTestCase {
      * This test can have the minimum time threshold updated to determine if the performance
      * is still sufficient compared to the existing threat model.
      */
-    @Ignore("Long running test")
+    @Disabled("Long running test")

Review comment:
       Enabled using a conditional property.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/PBKDF2CipherProviderGroovyTest.groovy
##########
@@ -468,7 +459,7 @@ class PBKDF2CipherProviderGroovyTest {
         }
     }
 
-    @Ignore("This test can be run on a specific machine to evaluate if the default iteration count is sufficient")
+    @Disabled("This test can be run on a specific machine to evaluate if the default iteration count is sufficient")

Review comment:
       Enabled on system property.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/NiFiLegacyCipherProviderGroovyTest.groovy
##########
@@ -124,8 +110,8 @@ class NiFiLegacyCipherProviderGroovyTest {
     @Test
     void testGetCipherWithUnlimitedStrengthShouldBeInternallyConsistent() throws Exception {
         // Arrange
-        Assume.assumeTrue("Test is being skipped due to this JVM lacking JCE Unlimited Strength Jurisdiction Policy file.",
-                CipherUtility.isUnlimitedStrengthCryptoSupported())
+        assumeTrue(CipherUtility.isUnlimitedStrengthCryptoSupported(),
+                "Test is being skipped due to this JVM lacking JCE Unlimited Strength Jurisdiction Policy file.")

Review comment:
       This can be removed.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/Argon2SecureHasherTest.groovy
##########
@@ -297,9 +299,14 @@ class Argon2SecureHasherTest extends GroovyTestCase {
      * This test can have the minimum time threshold updated to determine if the performance
      * is still sufficient compared to the existing threat model.
      */
-    @Ignore("Long running test")
+    @Disabled("Long running test")
     @Test
     void testDefaultCostParamsShouldBeSufficient() {
+        if (true) {
+            return //TODO: junit5-fix
+            //This appears to be necessitated by a collision between the vintage and jupiter engines in the surefire plugin
+        }

Review comment:
       This needs to be corrected, it looks like it should be flagged with EnabledOnSystemProperty given that it is a performance test.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/ScryptCipherProviderGroovyTest.groovy
##########
@@ -621,7 +612,7 @@ class ScryptCipherProviderGroovyTest {
         assert isScryptSalt
     }
 
-    @Ignore("This test can be run on a specific machine to evaluate if the default parameters are sufficient")
+    @Disabled("This test can be run on a specific machine to evaluate if the default parameters are sufficient")

Review comment:
       Enabled on system property.

##########
File path: nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/socket/TestSiteToSiteClient.java
##########
@@ -41,10 +40,14 @@
 import java.util.Map;
 import java.util.Set;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
 public class TestSiteToSiteClient {
 
     @Test
-    @Ignore("For local testing only; not really a unit test but a manual test")
+    @Disabled("For local testing only; not really a unit test but a manual test")

Review comment:
       Recommend removing this method or converting to an Integration Test class.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/scrypt/ScryptGroovyTest.groovy
##########
@@ -180,7 +165,7 @@ class ScryptGroovyTest {
         assert calculatedHash == HASH
     }
 
-    @Ignore("This test was just to exercise the heap and debug OOME issues")
+    @Disabled("This test was just to exercise the heap and debug OOME issues")

Review comment:
       Enabled on system property.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] asfgit closed pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #5332:
URL: https://github.com/apache/nifi/pull/5332


   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r697512891



##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/NiFiLegacyCipherProviderGroovyTest.groovy
##########
@@ -260,9 +247,14 @@ class NiFiLegacyCipherProviderGroovyTest {
      * from the password using a long digest result at the time of key length checking.
      * @throws IOException
      */
-    @Ignore("Only needed once to determine max supported password lengths")
+    @Disabled("Only needed once to determine max supported password lengths")
+    @Ignore
     @Test
     void testShouldDetermineDependenceOnUnlimitedStrengthCrypto() throws IOException {
+        if (true) {
+            return //Fix later
+            //TODO: junit5-fix
+        }

Review comment:
       Looking more closely at this specific test method, I recommend removing it completely. Java 8 has supported unlimited strength cryptography policies by default since [Java 8 Update 161](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8170157). There should be a separate effort to remove conditionals within runtime code, but for the purposes of this PR, removing the test method seems to be the best option.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r696836175



##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/NiFiLegacyCipherProviderGroovyTest.groovy
##########
@@ -260,9 +247,14 @@ class NiFiLegacyCipherProviderGroovyTest {
      * from the password using a long digest result at the time of key length checking.
      * @throws IOException
      */
-    @Ignore("Only needed once to determine max supported password lengths")
+    @Disabled("Only needed once to determine max supported password lengths")
+    @Ignore

Review comment:
       Thanks @MikeThomsen! For clarification, I am not recommending enabling currently ignored tests as part of the standard build, but to change some tests to use the [EnabledIfSystemProperty](https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/condition/EnabledIfSystemProperty.html) annotation. This type of test is a good example of something that should not be run by default, but could be useful under certain conditions.
   
   The evaluation needs to be done on a case-by-case basis, but there are a handful of performance-related tests that could be enabled through a System property.
   
   For this particular test method, the `NiFiLegacyCipherProvider` class itself is deprecated due to use of insecure algorithms, so I would support removing this method.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#issuecomment-933588144


   @exceptionfactory just saw your comment. I'll get on it.


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r700468237



##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/NiFiLegacyCipherProviderGroovyTest.groovy
##########
@@ -260,9 +247,14 @@ class NiFiLegacyCipherProviderGroovyTest {
      * from the password using a long digest result at the time of key length checking.
      * @throws IOException
      */
-    @Ignore("Only needed once to determine max supported password lengths")
+    @Disabled("Only needed once to determine max supported password lengths")
+    @Ignore

Review comment:
       I'm going to leave this as-is for now so that the whole test can be removed once the tested class is removed.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#issuecomment-938248214


   @exceptionfactory ready to go


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#issuecomment-944982147


   @exceptionfactory should be good now.


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r730264310



##########
File path: nifi-commons/nifi-record-path/src/test/java/org/apache/nifi/record/path/TestRecordPath.java
##########
@@ -1820,10 +1817,12 @@ public void testHash() {
         assertEquals("5753a498f025464d72e088a9d5d6e872592d5f91", RecordPath.compile("hash(/firstName, 'SHA-1')").evaluate(record).getSelectedFields().findFirst().get().getValue());
     }
 
-    @Test(expected = RecordPathException.class)
+    @Test
     public void testHashFailure() {
         final Record record = getCaseTestRecord();
-        assertEquals("61409aa1fd47d4a5332de23cbf59a36f", RecordPath.compile("hash(/firstName, 'NOT_A_ALGO')").evaluate(record).getSelectedFields().findFirst().get().getValue());
+        //assertEquals("61409aa1fd47d4a5332de23cbf59a36f", RecordPath.compile("hash(/firstName, 'NOT_A_ALGO')").evaluate(record).getSelectedFields().findFirst().get().getValue());

Review comment:
       I forgot to get rid of it when I removed the `expected` flag from the annotation.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#issuecomment-924508499


   Thanks the updates @MikeThomsen, can you rebase from the `main` branch to resolve conflicts from recent adjustments to unit tests?  I also noticed a handful of tests marked `Disabled`, some of which appear to be performance-related, others which might be potential candidates for removal.


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r700467021



##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/HashServiceTest.groovy
##########
@@ -387,13 +367,13 @@ class HashServiceTest extends GroovyTestCase {
     }
 
     @Test
-    void testShouldHashValueFromStream() throws Exception {
+    void testShouldHashValueFromStream(@TempDir Path temporaryFolder) throws Exception {
         // Arrange
 
         // No command-line md2sum tool available
         def algorithms = HashAlgorithm.values() - HashAlgorithm.MD2
 
-        File inputFile = temporaryFolder.newFile()
+        File inputFile = Files.createFile(temporaryFolder.resolve("test-${System.currentTimeMillis()}".toString())).toFile()

Review comment:
       Done.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#issuecomment-910554403


   @exceptionfactory I went back and did a number on this one, particularly in converting `fail()` to the appropriate throws/doesnothrow logic. Builds locally.


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r697472838



##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/NiFiLegacyCipherProviderGroovyTest.groovy
##########
@@ -260,9 +247,14 @@ class NiFiLegacyCipherProviderGroovyTest {
      * from the password using a long digest result at the time of key length checking.
      * @throws IOException
      */
-    @Ignore("Only needed once to determine max supported password lengths")
+    @Disabled("Only needed once to determine max supported password lengths")
+    @Ignore
     @Test
     void testShouldDetermineDependenceOnUnlimitedStrengthCrypto() throws IOException {
+        if (true) {
+            return //Fix later
+            //TODO: junit5-fix
+        }

Review comment:
       That wasn't a broken test per se, but a weird interplay within JUnit that was causing it to run a disabled test.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r696060096



##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/NiFiLegacyCipherProviderGroovyTest.groovy
##########
@@ -260,9 +247,14 @@ class NiFiLegacyCipherProviderGroovyTest {
      * from the password using a long digest result at the time of key length checking.
      * @throws IOException
      */
-    @Ignore("Only needed once to determine max supported password lengths")
+    @Disabled("Only needed once to determine max supported password lengths")
+    @Ignore
     @Test
     void testShouldDetermineDependenceOnUnlimitedStrengthCrypto() throws IOException {
+        if (true) {
+            return //Fix later
+            //TODO: junit5-fix
+        }

Review comment:
       If migrating to JUnit 5 breaks the test, we should hold off on migrating this module or test class.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/HashServiceTest.groovy
##########
@@ -387,13 +367,13 @@ class HashServiceTest extends GroovyTestCase {
     }
 
     @Test
-    void testShouldHashValueFromStream() throws Exception {
+    void testShouldHashValueFromStream(@TempDir Path temporaryFolder) throws Exception {
         // Arrange
 
         // No command-line md2sum tool available
         def algorithms = HashAlgorithm.values() - HashAlgorithm.MD2
 
-        File inputFile = temporaryFolder.newFile()
+        File inputFile = Files.createFile(temporaryFolder.resolve("test-${System.currentTimeMillis()}".toString())).toFile()

Review comment:
       It appears that the automated build is still failing this test method on Windows. It may be possible to refactor the test method to avoid writing files, or to use `Files.createTempFile()` instead of using the temporary folder.

##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/NiFiLegacyCipherProviderGroovyTest.groovy
##########
@@ -260,9 +247,14 @@ class NiFiLegacyCipherProviderGroovyTest {
      * from the password using a long digest result at the time of key length checking.
      * @throws IOException
      */
-    @Ignore("Only needed once to determine max supported password lengths")
+    @Disabled("Only needed once to determine max supported password lengths")
+    @Ignore

Review comment:
       Instead of continuing to mark these tests as ignored, this seems like the right opportunity to make the test conditional on an environment variable or system property. JUnit 5 provides first-class support for this approach.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on a change in pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on a change in pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#discussion_r696763080



##########
File path: nifi-commons/nifi-security-utils/src/test/groovy/org/apache/nifi/security/util/crypto/NiFiLegacyCipherProviderGroovyTest.groovy
##########
@@ -260,9 +247,14 @@ class NiFiLegacyCipherProviderGroovyTest {
      * from the password using a long digest result at the time of key length checking.
      * @throws IOException
      */
-    @Ignore("Only needed once to determine max supported password lengths")
+    @Disabled("Only needed once to determine max supported password lengths")
+    @Ignore

Review comment:
       I understand the logic, and will see what I can reasonably do there. That said, for the sake of keeping the build stable I am going to err strongly on the side of caution and keep tests disabled unless I or someone else feels confident that they should be enabled. A lot of these tests are old and odds are good that for a big chunk of them we may not have much memory of why they were disabled.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5332: NIFI-9080 Converted nifi-commons to use JUnit 5.

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5332:
URL: https://github.com/apache/nifi/pull/5332#issuecomment-920970768


   @exceptionfactory should be ready now


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org