elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
888 stars 24.81k forks source link

[CI] StatsSummaryTests.testEqualsAndHashCode fails with specific seed #112511

Closed cbuescher closed 4 days ago

cbuescher commented 2 months ago

CI Link

https://gradle-enterprise.elastic.co/s/izwjgujxyo3gk

Repro line

./gradlew ":server:test" --tests "org.elasticsearch.script.StatsSummaryTests.testEqualsAndHashCode" -Dtests.seed=47AD09731F61F063

Does it reproduce?

Yes

Applicable branches

main

Failure history

No response

Failure excerpt

This happened during local testing but I can reproduce on main:

./gradlew ":server:test" --tests "org.elasticsearch.script.StatsSummaryTests.testEqualsAndHashCode" -Dtests.seed=47AD09731F61F063

java.lang.AssertionError:
    Expected: not <StatsSummary{count=17, sum=7.483011, min=0.025528, average=0.440177, max=0.935507}>
         but: was <StatsSummary{count=17, sum=7.483011, min=0.025528, average=0.440177, max=0.935507}>
        at __randomizedtesting.SeedInfo.seed([47AD09731F61F063:3463F1BE1CC48F52]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
        at org.elasticsearch.test.ESTestCase.assertThat(ESTestCase.java:2466)
        at org.elasticsearch.script.StatsSummaryTests.testEqualsAndHashCode(StatsSummaryTests.java:80)
elasticsearchmachine commented 2 months ago

Pinging @elastic/es-search-relevance (Team:Search Relevance)

cbuescher commented 2 months ago

@afoucret this is coming from a test you added this morning, in case you already see whats up with this.

ChrisHegarty commented 4 days ago

This is a test issue. Removing needs:risk and adding low-risk.

There is no guarantee that the doubles added to stats1 and stats2 will be different.

  // Accumulators with different values are not equals
  randomDoubles(randomIntBetween(0, 20)).forEach(stats1);
  randomDoubles(randomIntBetween(0, 20)).forEach(stats2);
  assertThat(stats1, not(equalTo(stats2)));