gchq / Gaffer

A large-scale entity and relation database supporting aggregation of properties
Apache License 2.0
1.77k stars 350 forks source link

gh-3153 fixing flaky test shouldConstructGraphAndCreateViewWithGroups #3155

Closed omkrpt closed 8 months ago

omkrpt commented 8 months ago

What is the purpose of this PR

Why the test fails

How to reproduce the test failure

I used a tool called nondex.

mvn install -pl core/graph -am -DskipTests
mvn -pl core/graph test -Dtest=uk.gov.gchq.gaffer.graph.GraphTest#shouldConstructGraphAndCreateViewWithGroups
mvn -pl core/graph edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=uk.gov.gchq.gaffer.graph.GraphTest#shouldConstructGraphAndCreateViewWithGroups

Expected results

Actual results We get the following failures:

[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.551 s <<< FAILURE! -- in uk.gov.gchq.gaffer.graph.GraphTest
[ERROR] uk.gov.gchq.gaffer.graph.GraphTest.shouldConstructGraphAndCreateViewWithGroups(Store) -- Time elapsed: 0.537 s <<< FAILURE!
org.opentest4j.AssertionFailedError: array contents differ at index [0], expected: <entity2> but was: <entity3>
    at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
    at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
    at org.junit.jupiter.api.AssertArrayEquals.failArraysNotEqual(AssertArrayEquals.java:440)
    at org.junit.jupiter.api.AssertArrayEquals.assertArrayElementsEqual(AssertArrayEquals.java:389)
    at org.junit.jupiter.api.AssertArrayEquals.assertArrayEquals(AssertArrayEquals.java:346)
    at org.junit.jupiter.api.AssertArrayEquals.assertArrayEquals(AssertArrayEquals.java:159)
    at org.junit.jupiter.api.AssertArrayEquals.assertArrayEquals(AssertArrayEquals.java:155)
    at org.junit.jupiter.api.Assertions.assertArrayEquals(Assertions.java:1453)
    at uk.gov.gchq.gaffer.graph.GraphTest.shouldConstructGraphAndCreateViewWithGroups(GraphTest.java:925)
...

Description of fix Comparing the sets directly, without converting them to arrays.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (ac60289) 66.34% compared to head (3472917) 66.33%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #3155 +/- ## ============================================= - Coverage 66.34% 66.33% -0.02% + Complexity 2543 2541 -2 ============================================= Files 909 909 Lines 29026 29026 Branches 3225 3225 ============================================= - Hits 19257 19253 -4 - Misses 8333 8335 +2 - Partials 1436 1438 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.