Skip to content

Commit c7fb400

Browse files
author
Hendrik Muhs
authored
[Transform] remove deprecated endpoint from tests (#71891)
remove the use of the deprecated _data_frame endpoint from rest test cases, because it can prevent detecting problems in PR builds relates #71792
1 parent 5a7b1c6 commit c7fb400

File tree

3 files changed

+10
-47
lines changed

3 files changed

+10
-47
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import java.util.Map;
4848
import java.util.concurrent.TimeUnit;
4949

50-
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
5150
import static org.hamcrest.CoreMatchers.is;
5251
import static org.hamcrest.Matchers.equalTo;
5352
import static org.hamcrest.Matchers.greaterThan;
@@ -80,14 +79,8 @@ public void createIndexes() throws IOException {
8079
createReviewsIndex();
8180
indicesCreated = true;
8281

83-
// at random test the old deprecated roles, to be removed in 9.0.0
84-
if (useDeprecatedEndpoints() && randomBoolean()) {
85-
setupUser(TEST_USER_NAME, Collections.singletonList("data_frame_transforms_user"));
86-
setupUser(TEST_ADMIN_USER_NAME, Collections.singletonList("data_frame_transforms_admin"));
87-
} else {
88-
setupUser(TEST_USER_NAME, Collections.singletonList("transform_user"));
89-
setupUser(TEST_ADMIN_USER_NAME, Collections.singletonList("transform_admin"));
90-
}
82+
setupUser(TEST_USER_NAME, Collections.singletonList("transform_user"));
83+
setupUser(TEST_ADMIN_USER_NAME, Collections.singletonList("transform_admin"));
9184
}
9285

9386
@After

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.util.Set;
2929

3030
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
31-
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
3231
import static org.hamcrest.Matchers.containsString;
3332
import static org.hamcrest.Matchers.equalTo;
3433
import static org.hamcrest.Matchers.hasEntry;
@@ -66,13 +65,7 @@ public void createIndexes() throws IOException {
6665
createReviewsIndexNano();
6766
indicesCreated = true;
6867
setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME);
69-
70-
// at random test the old deprecated roles, to be removed in 9.0.0
71-
if (useDeprecatedEndpoints() && randomBoolean()) {
72-
setupUser(TEST_USER_NAME, Arrays.asList("data_frame_transforms_admin", DATA_ACCESS_ROLE));
73-
} else {
74-
setupUser(TEST_USER_NAME, Arrays.asList("transform_admin", DATA_ACCESS_ROLE));
75-
}
68+
setupUser(TEST_USER_NAME, Arrays.asList("transform_admin", DATA_ACCESS_ROLE));
7669
}
7770

7871
public void testSimplePivot() throws Exception {

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

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77

88
package org.elasticsearch.xpack.transform.integration;
99

10-
import org.apache.http.HttpHost;
1110
import org.apache.http.entity.ContentType;
1211
import org.apache.http.entity.StringEntity;
1312
import org.apache.logging.log4j.Level;
1413
import org.elasticsearch.client.Request;
1514
import org.elasticsearch.client.RequestOptions;
1615
import org.elasticsearch.client.Response;
1716
import org.elasticsearch.client.ResponseException;
18-
import org.elasticsearch.client.RestClient;
19-
import org.elasticsearch.client.RestClientBuilder;
2017
import org.elasticsearch.common.Strings;
2118
import org.elasticsearch.common.settings.SecureString;
2219
import org.elasticsearch.common.settings.Settings;
@@ -29,7 +26,6 @@
2926
import org.joda.time.Instant;
3027
import org.junit.After;
3128
import org.junit.AfterClass;
32-
import org.junit.BeforeClass;
3329

3430
import java.io.IOException;
3531
import java.util.Arrays;
@@ -52,34 +48,11 @@ public abstract class TransformRestTestCase extends ESRestTestCase {
5248
protected static final String REVIEWS_INDEX_NAME = "reviews";
5349
protected static final String REVIEWS_DATE_NANO_INDEX_NAME = "reviews_nano";
5450

55-
private static boolean useDeprecatedEndpoints;
56-
57-
protected boolean useDeprecatedEndpoints() {
58-
return useDeprecatedEndpoints;
59-
}
60-
61-
@BeforeClass
62-
public static void init() {
63-
// randomly return the old or the new endpoints, old endpoints to be removed for 8.0.0
64-
useDeprecatedEndpoints = randomBoolean();
65-
}
66-
6751
@Override
6852
protected Settings restClientSettings() {
6953
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", BASIC_AUTH_VALUE_SUPER_USER).build();
7054
}
7155

72-
@Override
73-
protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOException {
74-
if (useDeprecatedEndpoints) {
75-
RestClientBuilder builder = RestClient.builder(hosts);
76-
configureClient(builder, settings);
77-
builder.setStrictDeprecationMode(false);
78-
return builder.build();
79-
}
80-
return super.buildClient(settings, hosts);
81-
}
82-
8356
protected void createReviewsIndex(
8457
String indexName,
8558
int numDocs,
@@ -313,8 +286,12 @@ protected void createPivotReviewsTransform(
313286

314287
protected void createLatestReviewsTransform(String transformId, String transformIndex) throws IOException {
315288
String config = "{"
316-
+ " \"dest\": {\"index\":\"" + transformIndex + "\"},"
317-
+ " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"},"
289+
+ " \"dest\": {\"index\":\""
290+
+ transformIndex
291+
+ "\"},"
292+
+ " \"source\": {\"index\":\""
293+
+ REVIEWS_INDEX_NAME
294+
+ "\"},"
318295
+ " \"latest\": {"
319296
+ " \"unique_key\": [ \"user_id\" ],"
320297
+ " \"sort\": \"@timestamp\""
@@ -580,7 +557,7 @@ protected void assertOneCount(String query, String field, int expected) throws I
580557
}
581558

582559
protected static String getTransformEndpoint() {
583-
return useDeprecatedEndpoints ? TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED : TransformField.REST_BASE_PATH_TRANSFORMS;
560+
return TransformField.REST_BASE_PATH_TRANSFORMS;
584561
}
585562

586563
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)