From 61c496d320f940d3ea543c511e142511d7ced78b Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 5 Jun 2020 10:07:42 +0200 Subject: [PATCH] [Transform] use old roles only together with old endpoints (#57710) avoids a CI failure if new endpoints used together with old roles and warnings are asserted. --- .../transform/integration/TransformGetAndGetStatsIT.java | 8 ++++---- .../xpack/transform/integration/TransformPivotRestIT.java | 6 +++--- .../transform/integration/TransformRestTestCase.java | 4 ++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformGetAndGetStatsIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformGetAndGetStatsIT.java index dfeb203d3ca..454f6f06be6 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformGetAndGetStatsIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformGetAndGetStatsIT.java @@ -53,12 +53,12 @@ public class TransformGetAndGetStatsIT extends TransformRestTestCase { indicesCreated = true; // at random test the old deprecated roles, to be removed in 9.0.0 - if (randomBoolean()) { - setupUser(TEST_USER_NAME, Collections.singletonList("transform_user")); - setupUser(TEST_ADMIN_USER_NAME, Collections.singletonList("transform_admin")); - } else { + if (useDeprecatedEndpoints() && randomBoolean()) { setupUser(TEST_USER_NAME, Collections.singletonList("data_frame_transforms_user")); setupUser(TEST_ADMIN_USER_NAME, Collections.singletonList("data_frame_transforms_admin")); + } else { + setupUser(TEST_USER_NAME, Collections.singletonList("transform_user")); + setupUser(TEST_ADMIN_USER_NAME, Collections.singletonList("transform_admin")); } } diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java index 0c1f81f6003..6f65f12e5b5 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java @@ -67,10 +67,10 @@ public class TransformPivotRestIT extends TransformRestTestCase { setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME); // at random test the old deprecated roles, to be removed in 9.0.0 - if (randomBoolean()) { - setupUser(TEST_USER_NAME, Arrays.asList("transform_admin", DATA_ACCESS_ROLE)); - } else { + if (useDeprecatedEndpoints() && randomBoolean()) { setupUser(TEST_USER_NAME, Arrays.asList("data_frame_transforms_admin", DATA_ACCESS_ROLE)); + } else { + setupUser(TEST_USER_NAME, Arrays.asList("transform_admin", DATA_ACCESS_ROLE)); } } diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java index 61c8c67ba5e..b18df5ba8e5 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java @@ -54,6 +54,10 @@ public abstract class TransformRestTestCase extends ESRestTestCase { private static boolean useDeprecatedEndpoints; + protected boolean useDeprecatedEndpoints() { + return useDeprecatedEndpoints; + } + @BeforeClass public static void init() { // randomly return the old or the new endpoints, old endpoints to be removed for 8.0.0