Jiazhen Xu created NIFI-9818:
--------------------------------
Summary: Flaky tests due to HashMap/HashSet in nifi-record
Key: NIFI-9818
URL: https://issues.apache.org/jira/browse/NIFI-9818
Project: Apache NiFi
Issue Type: Bug
Reporter: Jiazhen Xu
**Description**
Four tests in `nifi-record`
(`org.apache.nifi.serialization.record.TestMapRecord#testDefaultValueWithAliasValue`
and`org.apache.nifi.serialization.record.TestMapRecord#testAliasConflictingAliasValues`,
`org.apache.nifi.serialization.record.TestDataTypeUtils#testInferTypeWithMapStringKeys`,
and
`org.apache.nifi.serialization.record.TestDataTypeUtils#testInferTypeWithMapNonStringKeys`)
can fail due to the non-deterministic order of iteration of _HashMap_ and
_HashSet_.
One can manifest this problem using
[[NonDex](https://github.com/TestingResearchIllinois/NonDex)](https://github.com/TestingResearchIllinois/NonDex):
```
mvn install -pl nifi-commons/nifi-record -am
mvn -pl nifi-commons/nifi-record edu.illinois:nondex-maven-plugin:1.1.2:nondex
-Dtest=org.apache.nifi.serialization.record.TestMapRecord#testAliasConflictingAliasValues
mvn -pl nifi-commons/nifi-record edu.illinois:nondex-maven-plugin:1.1.2:nondex
-Dtest=org.apache.nifi.serialization.record.TestMapRecord#testDefaultValueWithAliasValue
mvn -pl nifi-commons/nifi-record edu.illinois:nondex-maven-plugin:1.1.2:nondex
-Dtest=org.apache.nifi.serialization.record.TestDataTypeUtils#testInferTypeWithMapStringKeys
mvn -pl nifi-commons/nifi-record edu.illinois:nondex-maven-plugin:1.1.2:nondex
-Dtest=org.apache.nifi.serialization.record.TestDataTypeUtils#testInferTypeWithMapNonStringKe
```
**Fix Changes**
Use LinkedHashMap/LinkedHashSet instead of HashMap/HashSet in the test.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)