From d68e29f77ec47461f1c8bf5786e7dbff8aa03804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slobodan=20Adamovi=C4=87?= Date: Fri, 18 Oct 2024 18:52:04 +0200 Subject: [PATCH] [Test] Fix SearchRequestCacheDisablingInterceptorTests (#114828) The https://github.com/elastic/elasticsearch/pull/113501 PR introduced a change where `:index-name` is no longer considered a valid remote index name. The valid remote index name has to have a non-empty remote cluster name, e.g. `my-remote-cluster:index-name`. This PR changes tests to avoid randomly generating empty remote cluster names. Resolves https://github.com/elastic/elasticsearch/issues/113659, https://github.com/elastic/elasticsearch/issues/113660 (cherry picked from commit be22d2a4ea7596cc418f7ad33eb0ee01e746a3a5) # Conflicts: # muted-tests.yml --- muted-tests.yml | 8 +------- .../SearchRequestCacheDisablingInterceptorTests.java | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index 21eb9d23501f1..b6c0882198d07 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -275,12 +275,6 @@ tests: - class: org.elasticsearch.xpack.ml.integration.MlJobIT method: testGetJobs_GivenSingleJob issue: https://github.com/elastic/elasticsearch/issues/113655 -- class: org.elasticsearch.xpack.security.authz.interceptor.SearchRequestCacheDisablingInterceptorTests - method: testHasRemoteIndices - issue: https://github.com/elastic/elasticsearch/issues/113660 -- class: org.elasticsearch.xpack.security.authz.interceptor.SearchRequestCacheDisablingInterceptorTests - method: testRequestCacheWillBeDisabledWhenSearchRemoteIndices - issue: https://github.com/elastic/elasticsearch/issues/113659 - class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT method: test {p0=range/20_synthetic_source/Date range} issue: https://github.com/elastic/elasticsearch/issues/113874 @@ -428,4 +422,4 @@ tests: # issue: "https://github.com/elastic/elasticsearch/..." # - class: "org.elasticsearch.xpack.esql.**" # method: "test {union_types.MultiIndexIpStringStatsInline *}" -# issue: "https://github.com/elastic/elasticsearch/..." +# issue: "https://github.com/elastic/elasticsearch/..." \ No newline at end of file diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/interceptor/SearchRequestCacheDisablingInterceptorTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/interceptor/SearchRequestCacheDisablingInterceptorTests.java index 2c4a03b7df501..b09527061f0d5 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/interceptor/SearchRequestCacheDisablingInterceptorTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/interceptor/SearchRequestCacheDisablingInterceptorTests.java @@ -91,7 +91,7 @@ public void testRequestCacheWillBeDisabledWhenSearchRemoteIndices() { 0, 3, String[]::new, - () -> randomAlphaOfLengthBetween(0, 5) + ":" + randomAlphaOfLengthBetween(3, 8) + () -> randomAlphaOfLengthBetween(1, 5) + ":" + randomAlphaOfLengthBetween(3, 8) ); final ArrayList allIndices = Arrays.stream(ArrayUtils.concat(localIndices, remoteIndices)) .collect(Collectors.toCollection(ArrayList::new)); @@ -121,7 +121,7 @@ public void testHasRemoteIndices() { 0, 3, String[]::new, - () -> randomAlphaOfLengthBetween(0, 5) + ":" + randomAlphaOfLengthBetween(3, 8) + () -> randomAlphaOfLengthBetween(1, 5) + ":" + randomAlphaOfLengthBetween(3, 8) ); final ArrayList allIndices = Arrays.stream(ArrayUtils.concat(localIndices, remoteIndices)) .collect(Collectors.toCollection(ArrayList::new));