Delete indices after each test
This commit is contained in:
parent
041804eb1f
commit
da55d49316
@ -1,8 +1,8 @@
|
||||
package io.volvox.chats;
|
||||
|
||||
import io.quarkus.test.junit.NativeImageTest;
|
||||
import io.quarkus.test.junit.QuarkusIntegrationTest;
|
||||
|
||||
@NativeImageTest
|
||||
@QuarkusIntegrationTest
|
||||
public class ChatsEndpointTestIT extends ChatsEndpointTest {
|
||||
|
||||
// Execute the same tests but in native mode.
|
||||
|
@ -7,6 +7,7 @@ import io.vertx.core.json.JsonObject;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.inject.Inject;
|
||||
import org.elasticsearch.ElasticsearchStatusException;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
@ -34,8 +35,12 @@ public class ChatsServiceWarmup {
|
||||
}
|
||||
|
||||
private void createIndices() {
|
||||
var req = new CreateIndexRequest("chats");
|
||||
try {
|
||||
var req = new DeleteIndexRequest("chats");
|
||||
restHighLevelClient.indices().deleteAsyncAndAwait(req, RequestOptions.DEFAULT);
|
||||
} catch (ElasticsearchStatusException ignored) {}
|
||||
try {
|
||||
var req = new CreateIndexRequest("chats");
|
||||
restHighLevelClient.indices().createAsyncAndAwait(req, RequestOptions.DEFAULT);
|
||||
} catch (ElasticsearchStatusException ex) {
|
||||
if (ex.status() != RestStatus.BAD_REQUEST) {
|
||||
|
Loading…
Reference in New Issue
Block a user