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

TestCompareFuzzyHash.testTLSHCompareFuzzyHashMultipleMatches uses non-deterministic HashMap

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 1.19.0
    • Extensions
    • None
    • Apache Maven 3.6.0;
      openjdk version "1.8.0_342";
      OpenJDK Runtime Environment (build 1.8.0_342-8u342-b07-0ubuntu1~20.04-b07);
      OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode);

    Description

      org.apache.nifi.processors.cybersecurity.TestCompareFuzzyHash.testTLSHCompareFuzzyHashMultipleMatches

      This is a flaky test, it can pass mvn test while but when run using the tool NonDex, it fails. NonDex is a tool that will introduce non-determinism in certain java collections.

      The test shows below:

      [ERROR] Failures:
      [ERROR]   TestCompareFuzzyHash.testTLSHCompareFuzzyHashMultipleMatches:232 Expected attribute fuzzyhash.value.0.match to be nifi-nar-bundles/nifi-lumberjack-bundle/nifi-lumberjack-processors/pom.xml but instead it was nifi-nar-bundles/nifi-beats-bundle/nifi-beats-processors/pom.xml ==> expected: <nifi-nar-bundles/nifi-lumberjack-bundle/nifi-lumberjack-processors/pom.xml> but was: <nifi-nar-bundles/nifi-beats-bundle/nifi-beats-processors/pom.xml>
      

      Steps to reproduce the failure:

      1. Run the following command in nifi:
      2. First, build the module:
      mvn install -pl nifi-nar-bundles/nifi-cybersecurity-bundle/nifi-cybersecurity-processors -DskipTests -Drat.skip -am
      1. Then run the test using NonDex
      mvn -pl nifi-nar-bundles/nifi-cybersecurity-bundle/nifi-cybersecurity-processors nondex:nondex -Dtest=org.apache.nifi.processors.cybersecurity.TestCompareFuzzyHash#testTLSHCompareFuzzyHashMultipleMatches

      The result will be saved under the module folder in .nondex

      Another test, TestCompareFuzzyHash.testSsdeepCompareFuzzyHashMultipleMatches depended on the HashMap which was changed as a part of the fix for this JIRA. The simple fix for this was to make the order of checking the items the same as the insertion order.

      Attachments

        Issue Links

          Activity

            People

              sopan98 Sopan Phaltankar
              sopan98 Sopan Phaltankar
              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 - 20m
                  20m