From f60c0f893cb5bed2ae6adc1102b646c10b387db1 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Thu, 29 Jun 2017 07:14:11 -0600 Subject: [PATCH] Test: add a basic rest test for CCS with non-matching remote index patterns (elastic/x-pack-elasticsearch#1866) This commit adds a basic rest test to verify that security works with cross cluster search when a remote pattern is provided and no remote indices match. Relates elastic/elasticsearch#25436 relates elastic/x-pack-elasticsearch#1854 Original commit: elastic/x-pack-elasticsearch@e804d0bb121528fcee586d1ea9289aed13696375 --- .../test/multi_cluster/50_missing.yml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 qa/multi-cluster-search-security/src/test/resources/rest-api-spec/test/multi_cluster/50_missing.yml diff --git a/qa/multi-cluster-search-security/src/test/resources/rest-api-spec/test/multi_cluster/50_missing.yml b/qa/multi-cluster-search-security/src/test/resources/rest-api-spec/test/multi_cluster/50_missing.yml new file mode 100644 index 00000000000..9c445f418da --- /dev/null +++ b/qa/multi-cluster-search-security/src/test/resources/rest-api-spec/test/multi_cluster/50_missing.yml @@ -0,0 +1,68 @@ +--- +setup: + - skip: + features: headers + + - do: + cluster.health: + wait_for_status: yellow + - do: + xpack.security.put_user: + username: "joe" + body: > + { + "password": "s3krit", + "roles" : [ "x_cluster_role" ] + } + - do: + xpack.security.put_role: + name: "x_cluster_role" + body: > + { + "cluster": ["all"], + "indices": [ + { + "names": ["local_index", "my_remote_cluster:test_i*", "my_remote_cluster:aliased_test_index", "test_remote_cluster:test_i*", "my_remote_cluster:secure_alias"], + "privileges": ["read"] + } + ] + } +--- +teardown: + - do: + xpack.security.delete_user: + username: "joe" + ignore: 404 + - do: + xpack.security.delete_role: + name: "x_cluster_role" + ignore: 404 +--- +"Search with missing remote index pattern": + - do: + headers: { Authorization: "Basic am9lOnMza3JpdA==" } + search: + index: "*:foo-*" + + - match: { _shards.total: 0 } + - match: { hits.total: 0 } + + - do: + headers: { Authorization: "Basic am9lOnMza3JpdA==" } + search: + index: "my_remote_cluster:foo-*" + + - match: { _shards.total: 0 } + - match: { hits.total: 0 } + + - do: + catch: "request" + headers: { Authorization: "Basic am9lOnMza3JpdA==" } + search: + index: "*:foo-bar" + + - do: + catch: "request" + headers: { Authorization: "Basic am9lOnMza3JpdA==" } + search: + index: "my_remote_cluster:foo-bar"