Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-9818

Flaky tests due to HashMap/HashSet in nifi-record

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.16.0
    • None
    • None

    Description

      Four tests in nifi-record (org.apache.nifi.serialization.record.TestMapRecord#testDefaultValueWithAliasValue 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)]

      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 

      Use LinkedHashMap/LinkedHashSet instead of HashMap/HashSet in the test can solve the problem.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Jiazhenx Jiazhen Xu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m