Skip to content

Commit 9f28152

Browse files
committed
Test Runner: Adds enterprise search users for entsearch platinum tests
1 parent 2198c21 commit 9f28152

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

elasticsearch-api/api-spec-testing/wipe_cluster.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,55 @@ def self.create_xpack_rest_user(client)
6161
)
6262
end
6363

64+
def self.create_enterprise_search_users(client)
65+
client.security.put_role(
66+
name: 'entuser',
67+
body: {
68+
cluster: [
69+
'post_behavioral_analytics_event',
70+
'manage_api_key',
71+
'read_connector_secrets',
72+
'write_connector_secrets'
73+
],
74+
indices: [
75+
{
76+
names: [
77+
'test-index1',
78+
'test-search-application',
79+
'test-search-application-1',
80+
'test-search-application-with-aggs',
81+
'test-search-application-with-list',
82+
'test-search-application-with-list-invalid',
83+
'.elastic-connectors-v1',
84+
'.elastic-connectors-sync-jobs-v1'
85+
],
86+
privileges: ['read']
87+
}
88+
]
89+
}
90+
)
91+
client.security.put_role(
92+
name: 'unprivileged',
93+
body: {
94+
indices: [
95+
{
96+
names: ['test-*', 'another-test-search-application'],
97+
privileges: ['manage', 'write', 'read']
98+
}
99+
]
100+
}
101+
)
102+
103+
client.security.put_user(
104+
username: 'entsearch-user',
105+
body: { password: 'entsearch-user-password', roles: ['entuser'] }
106+
)
107+
client.security.put_user(
108+
username: 'entsearch-unprivileged',
109+
body: { password: 'entsearch-unprivileged-password', roles: ['privileged'] }
110+
)
111+
end
112+
64113
class << self
65114
private
66115

elasticsearch-api/spec/rest_api/rest_api_tests_helper.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@
6565
exit
6666
end
6767

68-
Elasticsearch::RestAPIYAMLTests::WipeCluster.create_xpack_rest_user(ADMIN_CLIENT) if test_suite == 'platinum'
68+
if test_suite == 'platinum'
69+
Elasticsearch::RestAPIYAMLTests::WipeCluster.create_xpack_rest_user(ADMIN_CLIENT)
70+
Elasticsearch::RestAPIYAMLTests::WipeCluster.create_enterprise_search_users(ADMIN_CLIENT)
71+
end
6972

7073
YAML_FILES_DIRECTORY = "#{PROJECT_PATH}/../../tmp/rest-api-spec/test/#{test_suite}".freeze
7174

0 commit comments

Comments
 (0)