Skip to content

Commit c6cd3d4

Browse files
DaveCTurnerfzowl
authored andcommitted
Revert "Test utility for POST _features/_reset (elastic#137133)"
This reverts commit df67e27.
1 parent 10e89e5 commit c6cd3d4

File tree

13 files changed

+18
-24
lines changed

13 files changed

+18
-24
lines changed

qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/FeatureUpgradeApiIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class FeatureUpgradeApiIT extends AbstractSystemIndicesIT {
2929

3030
@After
3131
public void resetFeatures() throws Exception {
32-
performPostFeaturesReset(client());
32+
client().performRequest(new Request("POST", "/_features/_reset"));
3333
}
3434

3535
public void testCreatingSystemIndex() throws Exception {

qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/NetNewSystemIndicesIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ public void testSearch() throws Exception {
9494

9595
@After
9696
public void resetFeatures() throws Exception {
97-
performPostFeaturesReset(client());
97+
client().performRequest(new Request("POST", "/_features/_reset"));
9898
}
9999
}

qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/SystemAliasIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class SystemAliasIT extends AbstractSystemIndicesIT {
2626

2727
@After
2828
public void resetFeatures() throws Exception {
29-
performPostFeaturesReset(client());
29+
client().performRequest(new Request("POST", "/_features/_reset"));
3030
}
3131

3232
public void testCreatingSystemIndexWithAlias() throws Exception {

test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -925,16 +925,6 @@ protected boolean preserveSearchableSnapshotsIndicesUponCompletion() {
925925
return false;
926926
}
927927

928-
/**
929-
* Invoke {@code POST /_features/_reset?error_trace&master_timeout=-1} with the given {@link RestClient}.
930-
*/
931-
public static void performPostFeaturesReset(RestClient restClient) throws IOException {
932-
final var request = new Request(HttpPost.METHOD_NAME, "/_features/_reset");
933-
request.addParameter("error_trace", "true");
934-
request.addParameter("master_timeout", "-1");
935-
assertOK(restClient.performRequest(request));
936-
}
937-
938928
private void wipeCluster() throws Exception {
939929
waitForClusterUpdates();
940930

@@ -961,7 +951,8 @@ private void wipeCluster() throws Exception {
961951
wipeSnapshots();
962952

963953
if (resetFeatureStates()) {
964-
performPostFeaturesReset(cleanupClient());
954+
final Request postRequest = new Request("POST", "/_features/_reset");
955+
cleanupClient().performRequest(postRequest);
965956
}
966957

967958
// wipe data streams before indices so that the backing indices for data streams are handled properly

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/integration/MlRestTestStateCleaner.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import java.util.List;
1818
import java.util.Map;
1919

20-
import static org.elasticsearch.test.rest.ESRestTestCase.performPostFeaturesReset;
2120
import static org.hamcrest.MatcherAssert.assertThat;
2221
import static org.hamcrest.Matchers.hasSize;
2322

@@ -34,7 +33,7 @@ public MlRestTestStateCleaner(Logger logger, RestClient adminClient) {
3433
public void resetFeatures() throws IOException {
3534
deletePipelinesWithInferenceProcessors();
3635
// This resets all features, not just ML, but they should have been getting reset between tests anyway so it shouldn't matter
37-
performPostFeaturesReset(adminClient);
36+
adminClient.performRequest(new Request("POST", "/_features/_reset"));
3837
}
3938

4039
@SuppressWarnings("unchecked")

x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ protected String getTestRestCluster() {
5959

6060
@After
6161
public void resetFeatures() throws IOException {
62-
performPostFeaturesReset(adminClient());
62+
Response response = adminClient().performRequest(new Request("POST", "/_features/_reset"));
63+
assertOK(response);
6364
}
6465

6566
@Override

x-pack/plugin/ml/qa/disabled/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public void testActionsFail() throws Exception {
7575
}
7676

7777
public void testMlFeatureReset() throws IOException {
78-
performPostFeaturesReset(client());
78+
Request request = new Request("POST", "/_features/_reset");
79+
assertOK(client().performRequest(request));
7980
}
8081

8182
@SuppressWarnings("unchecked")

x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InferenceTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void cleanup() throws Exception {
3333
}
3434
createdPipelines.clear();
3535
waitForStats();
36-
performPostFeaturesReset(adminClient());
36+
adminClient().performRequest(new Request("POST", "/_features/_reset"));
3737
}
3838

3939
void deletePipeline(String pipelineId) throws IOException {

x-pack/plugin/transform/qa/multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TestFeatureResetIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
package org.elasticsearch.xpack.transform.integration;
88

9+
import org.apache.http.client.methods.HttpPost;
910
import org.elasticsearch.client.Request;
1011
import org.elasticsearch.client.RequestOptions;
1112
import org.elasticsearch.client.Response;
@@ -94,7 +95,7 @@ public void testTransformFeatureReset() throws Exception {
9495

9596
startTransform(continuousTransformId, RequestOptions.DEFAULT);
9697

97-
performPostFeaturesReset(client());
98+
assertOK(client().performRequest(new Request(HttpPost.METHOD_NAME, "/_features/_reset")));
9899

99100
Response response = adminClient().performRequest(new Request("GET", "/_cluster/state?metric=metadata"));
100101
Map<String, Object> metadata = (Map<String, Object>) ESRestTestCase.entityAsMap(response).get("metadata");

x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformGetAndGetStatsIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void createIndexes() throws IOException {
6666

6767
@After
6868
public void clearOutTransforms() throws Exception {
69-
performPostFeaturesReset(adminClient());
69+
adminClient().performRequest(new Request("POST", "/_features/_reset"));
7070
}
7171

7272
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)