[ 
https://issues.apache.org/jira/browse/NIFI-593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14529836#comment-14529836
 ] 

Joseph Witt commented on NIFI-593:
----------------------------------

Here was the failure i saw:

{quote}
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.nifi.nar.NarUnpackerTest
Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.148 sec <<< 
FAILURE! - in org.apache.nifi.nar.NarUnpackerTest
testUnpackNars(org.apache.nifi.nar.NarUnpackerTest)  Time elapsed: 0.043 sec  
<<< FAILURE!
org.junit.ComparisonFailure: expected:<dummy-[one].nar-unpacked> but 
was:<dummy-[two].nar-unpacked>
  at org.junit.Assert.assertEquals(Assert.java:115)
  at org.junit.Assert.assertEquals(Assert.java:144)
  at 
org.apache.nifi.nar.NarUnpackerTest.testUnpackNars(NarUnpackerTest.java:100)


Results :

Failed tests: 
  NarUnpackerTest.testUnpackNars:100 expected:<dummy-[one].nar-unpacked> but 
was:<dummy-[two].nar-unpacked>
{quote}

> Possible test failures due to no guarantee of ordering for directory 
> properties
> -------------------------------------------------------------------------------
>
>                 Key: NIFI-593
>                 URL: https://issues.apache.org/jira/browse/NIFI-593
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 0.1.0
>            Reporter: Aldrin Piri
>            Priority: Blocker
>
> org.apache.nifi.nar.NarUnpackerTest#testUnpackNars makes explicit selections 
> of listed directories by array index.  This can be problematic as those 
> listings are not guaranteed to be ordered.
> This signature is also present in NiFiPropertiesTest#testProperties where a 
> similar selection of value is provided via an element index.
> Results where order is not guaranteed and does not matter need to have their 
> semantics changed to model those of a Set in lieu of the List that is 
> typically returned.
> A scan needs to be performed for such problem cases and converted to use this.
> Something along the lines would be sufficient:
> {code}
>         final File extensionsWorkingDir = 
> properties.getExtensionsWorkingDirectory();
>         File[] extensionFiles = extensionsWorkingDir.listFiles();
>         Set<String> expectedNars = new HashSet<>();
>         expectedNars.add("dummy-one.nar-unpacked");
>         expectedNars.add("dummy-two.nar-unpacked");
>         assertEquals(expectedNars.size(), extensionFiles.length);
>         for (File extensionFile : extensionFiles) {
>             Assert.assertTrue(expectedNars.contains(extensionFile.getName()));
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to