Skip to content

Commit

Permalink
Bound ack time (#87787)
Browse files Browse the repository at this point in the history
Currently, our default wait time for ack is unbound. This could result
in an entire test suite timeout rather than individual test cases
failures.
  • Loading branch information
idegtiarenko authored Jun 20, 2022
1 parent f7ef660 commit 0b37360
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.get.GetResponse;
Expand Down Expand Up @@ -85,7 +84,11 @@
public class ElasticsearchAssertions {

public static void assertAcked(AcknowledgedRequestBuilder<?, ?, ?> builder) {
assertAcked(builder.get());
assertAcked(builder, TimeValue.timeValueSeconds(30));
}

public static void assertAcked(AcknowledgedRequestBuilder<?, ?, ?> builder, TimeValue timeValue) {
assertAcked(builder.get(timeValue));
}

public static void assertNoTimeout(ClusterHealthRequestBuilder requestBuilder) {
Expand All @@ -100,10 +103,6 @@ public static void assertAcked(AcknowledgedResponse response) {
assertThat(response.getClass().getSimpleName() + " failed - not acked", response.isAcknowledged(), equalTo(true));
}

public static void assertAcked(DeleteIndexRequestBuilder builder) {
assertAcked(builder.get());
}

/**
* Assert that an index creation was fully acknowledged, meaning that both the index creation cluster
* state update was successful and that the requisite number of shard copies were started before returning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void testScaleFromEmptyLegacy() {
.put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
.put(IndexMetadata.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "data_tier", "hot")
.build()
)
).setWaitForActiveShards(ActiveShardCount.NONE)
);

// the tier preference will have defaulted to data_content, set it back to null
Expand Down

0 comments on commit 0b37360

Please sign in to comment.