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@e804d0bb12
This commit is contained in:
Jay Modi 2017-06-29 07:14:11 -06:00 committed by GitHub
parent 3ff5ee3f47
commit f60c0f893c
1 changed files with 68 additions and 0 deletions

View File

@ -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"