Skip to content

Commit

Permalink
Fix release tests (#58713) (#58725)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7816c100612168bf46595c4813fe374bca2e7259)
  • Loading branch information
astefan authored Jun 30, 2020
1 parent 4e03633 commit 7b80ea7
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.elasticsearch.Build;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.eql.EqlSearchRequest;
import org.elasticsearch.client.eql.EqlSearchResponse;
Expand All @@ -20,7 +19,7 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.junit.AfterClass;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;

Expand All @@ -35,6 +34,7 @@
public abstract class CommonEqlActionTestCase extends ESRestTestCase {

protected static final String PARAM_FORMATTING = "%1$s.test -> %2$s";
private static int counter = 0;
private RestHighLevelClient highLevelClient;

@BeforeClass
Expand All @@ -49,15 +49,10 @@ public void setup() throws Exception {
}
}

@AfterClass
public static void cleanup() throws Exception {
try {
adminClient().performRequest(new Request("DELETE", "/*"));
} catch (ResponseException e) {
// 404 here just means we had no indexes
if (e.getResponse().getStatusLine().getStatusCode() != 404) {
throw e;
}
@After
public void cleanup() throws Exception {
if (--counter == 0) {
deleteIndex(testIndexName);
}
}

Expand Down Expand Up @@ -86,10 +81,11 @@ public static List<Object[]> readTestSpecs() throws Exception {
filteredSpecs.add(spec);
}
}
counter = specs.size();
return asArray(filteredSpecs);
}

public static List<Object[]> asArray(List<EqlSpec> specs) {
private static List<Object[]> asArray(List<EqlSpec> specs) {
AtomicInteger counter = new AtomicInteger();
return specs.stream().map(spec -> {
String name = spec.description();
Expand Down

0 comments on commit 7b80ea7

Please sign in to comment.