Skip to content

Commit

Permalink
Do not create the index, if it's already there (#59745) (#59748)
Browse files Browse the repository at this point in the history
(cherry picked from commit d097447)
  • Loading branch information
astefan committed Jul 17, 2020
1 parent 1f283c7 commit 9c75ce9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Set;

import static java.util.Collections.unmodifiableSet;
import static org.elasticsearch.test.eql.DataLoader.testIndexName;

/**
* Tests a random number of queries that increase various (most of the times, one query will "touch" multiple metrics values) metrics.
Expand Down Expand Up @@ -119,7 +120,12 @@ private Map getFeaturesMetrics(Map perNodeStats) {
}

public void testEqlRestUsage() throws IOException {
DataLoader.loadDatasetIntoEs(highLevelClient(), (t, u) -> createParser(t, u));
// create the index and load the data, if the index doesn't exist
// it doesn't matter if the index is already there (probably created by another test); _if_ its mapping is the expected one
// it should be enough
if (client().performRequest(new Request("HEAD", "/" + testIndexName)).getStatusLine().getStatusCode() == 404) {
DataLoader.loadDatasetIntoEs(highLevelClient(), (t, u) -> createParser(t, u));
}

//
// random event queries
Expand Down

0 comments on commit 9c75ce9

Please sign in to comment.