Skip to content

DeadHostsStateTests failing on Windows #33747

@DaveCTurner

Description

@DaveCTurner

I see a variety of failures of the following form on the Windows compatibility tests:

Suite: org.elasticsearch.client.DeadHostStateTests
FAILURE 0.01s J0 | DeadHostStateTests.testCompareToDefaultTimeSupplier <<< FAILURES!
   > Throwable #1: java.lang.AssertionError: 
   > Expected: a value less than <15864990105023L>
   >      but: <15864990105023L> was equal to <15864990105023L>
   > 	at __randomizedtesting.SeedInfo.seed([CD210BC9F8F37963:56E027485D8503A0]:0)
   > 	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
   > 	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
   > 	at org.elasticsearch.client.DeadHostStateTests.testCompareToDefaultTimeSupplier(DeadHostStateTests.java:67)
   > 	at java.lang.Thread.run(Thread.java:748)

E.g.

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.4+multijob-windows-compatibility/2/console

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.x+multijob-windows-compatibility/6/console

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-windows-compatibility/3/console

The issue, I believe, is that we use DeadHostState.TimeSupplier.DEFAULT in the tests, which wrap System.getNanoTime(), and we assume that the value it returns increases between loop iterations. Each iteration likely takes more than 1ns but System.getNanoTime() is not so accurate, particularly on Windows, and this causes the tests to fail sometimes.

Marking this as @AwaitsFix since I think it'd be better to use our own time supplier throughout these tests rather than System.getNanoTime() here, and this seems to require a bit of rework.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions