mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-03 17:39:15 +00:00
[TEST] Force flush even if not needed to ensure successful shards is greater than 0
This commit is contained in:
parent
76fab9d42a
commit
93b56eb004
@ -38,6 +38,11 @@ public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushR
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FlushRequestBuilder setForce(boolean force) {
|
||||||
|
request.force(force);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doExecute(ActionListener<FlushResponse> listener) {
|
protected void doExecute(ActionListener<FlushResponse> listener) {
|
||||||
((IndicesAdminClient) client).flush(request, listener);
|
((IndicesAdminClient) client).flush(request, listener);
|
||||||
|
@ -851,7 +851,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
|
|||||||
assertThat(getResponse.getField(field).getValues().get(0).toString(), equalTo("value1"));
|
assertThat(getResponse.getField(field).getValues().get(0).toString(), equalTo("value1"));
|
||||||
assertThat(getResponse.getField(field).getValues().get(1).toString(), equalTo("value2"));
|
assertThat(getResponse.getField(field).getValues().get(1).toString(), equalTo("value2"));
|
||||||
|
|
||||||
FlushResponse flushResponse = client().admin().indices().prepareFlush("my-index").get();
|
FlushResponse flushResponse = client().admin().indices().prepareFlush("my-index").setForce(true).get();
|
||||||
// the flush must at least succeed on one shard and not all shards, because we don't wait for yellow/green
|
// the flush must at least succeed on one shard and not all shards, because we don't wait for yellow/green
|
||||||
assertThat(flushResponse.getSuccessfulShards(), greaterThanOrEqualTo(1));
|
assertThat(flushResponse.getSuccessfulShards(), greaterThanOrEqualTo(1));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user