Skip to content

[TEST] NoMasterNodeIT.testNoMasterActions fails #24369

@ywelsch

Description

@ywelsch

This test sporadically fails when it runs on a CI machine that slows down a bit. The test relies on timing, which is a big NONO:

long now = System.currentTimeMillis();
try {
    builder.get();
    fail("Expected ClusterBlockException");
} catch (ClusterBlockException e) {
    if (indexShouldBeAutoCreated) {
        // timeout is 200
        assertThat(System.currentTimeMillis() - now, greaterThan(timeout.millis() - 50));
        assertThat(e.status(), equalTo(RestStatus.SERVICE_UNAVAILABLE));
    } else {
        // timeout is 5000
        assertThat(System.currentTimeMillis() - now, lessThan(timeout.millis() + 300));
    }
}

Failure:

ERROR   33.8s J0 | NoMasterNodeIT.testNoMasterActions <<< FAILURES!
   > Throwable #1: java.lang.AssertionError: 
   > Expected: a value less than <250L>
   >      but: <269L> was greater than <250L>
   > 	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
   > 	at org.elasticsearch.cluster.NoMasterNodeIT.checkWriteAction(NoMasterNodeIT.java:182)
   > 	at org.elasticsearch.cluster.NoMasterNodeIT.testNoMasterActions(NoMasterNodeIT.java:127)
   > 	at java.lang.Thread.run(Thread.java:745)Throwable #2: MasterNotDiscoveredException[null]
   > 	at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$4.onTimeout(TransportMasterNodeAction.java:209)
...

Build: https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+5.4+multijob-windows-compatibility/46/consoleFull

Metadata

Metadata

Assignees

Labels

>testIssues or PRs that are addressing/adding tests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions