Use assertAcked more (#101201)

Just found that we have a lot of inconsistency and needless verbosity
here in tests. We can just use `assertAcked` in a couple spots
to save `.get`, `.actionGet` etc., especially with the signature
change I added here.
This commit is contained in:
Armin Braun 2023-10-23 19:48:10 +02:00 committed by GitHub
parent 84afa5cee3
commit 3945ee75d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
100 changed files with 130 additions and 343 deletions

View file

@ -19,7 +19,6 @@ import org.apache.lucene.tests.util.TimeUnits;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.LatchedActionListener;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
import org.elasticsearch.action.bulk.BulkProcessor2;
import org.elasticsearch.action.bulk.BulkRequest;
@ -187,8 +186,7 @@ public class CCSDuelIT extends ESRestTestCase {
IndexResponse indexResponse = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
assertEquals(201, indexResponse.status().getStatus());
CreateIndexResponse response = createIndex(INDEX_NAME + "_empty");
assertTrue(response.isAcknowledged());
ElasticsearchAssertions.assertAcked(createIndex(INDEX_NAME + "_empty"));
int numShards = randomIntBetween(1, 5);
Settings settings = indexSettings(numShards, 0).build();
@ -209,8 +207,7 @@ public class CCSDuelIT extends ESRestTestCase {
}
}
}""";
response = createIndex(INDEX_NAME, settings, mapping);
assertTrue(response.isAcknowledged());
ElasticsearchAssertions.assertAcked(createIndex(INDEX_NAME, settings, mapping));
BulkProcessor2 bulkProcessor = BulkProcessor2.builder(
(r, l) -> restHighLevelClient.bulkAsync(r, RequestOptions.DEFAULT, l),