[
https://issues.apache.org/jira/browse/NIFI-593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aldrin Piri updated NIFI-593:
-----------------------------
Summary: Possible test failures due to no guarantee of ordering for
directory properties (was: Ordering is not guaranteed for directory listings)
> 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)