Skip to content

Commit ac2e0e1

Browse files
committed
[API] Test Runner: use x_pack_rest_user auth
1 parent b5b1b3e commit ac2e0e1

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

elasticsearch-api/api-spec-testing/test_file/action.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ def execute(client, test = nil)
8383
client
8484
when 'headers'
8585
headers = prepare_arguments(args, test)
86-
# TODO: Remove Authorization headers while x_pack_rest_user is fixed
87-
if headers[:Authorization] == 'Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=='
88-
headers.delete(:Authorization)
89-
end
9086
host = client.transport.instance_variable_get('@hosts')
9187
transport_options = client.transport.instance_variable_get('@options')&.dig(:transport_options) || {}
9288
if ENV['QUIET'] == 'true'

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ def self.run(client)
5050
check_for_unexpectedly_recreated_objects(client)
5151
end
5252

53+
def self.create_xpack_rest_user(client)
54+
client.security.put_user(
55+
username: 'x_pack_rest_user',
56+
body: { password: 'x-pack-test-password', roles: ['superuser'] }
57+
)
58+
end
59+
5360
class << self
5461
private
5562

@@ -308,13 +315,6 @@ def delete_all_follow_patterns(client)
308315
end
309316
end
310317

311-
def create_xpack_rest_user(client)
312-
client.security.put_user(
313-
username: 'x_pack_rest_user',
314-
body: { password: 'x-pack-test-password', roles: ['superuser'] }
315-
)
316-
end
317-
318318
def clear_roles(client)
319319
client.security.get_role.each do |role, _|
320320
begin; client.security.delete_role(name: role); rescue; end

elasticsearch-api/spec/rest_api_tests_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
exit
5959
end
6060

61+
Elasticsearch::RestAPIYAMLTests::WipeCluster.create_xpack_rest_user(ADMIN_CLIENT) if test_suite == 'platinum'
62+
6163
YAML_FILES_DIRECTORY = "#{PROJECT_PATH}/../tmp/rest-api-spec/test/#{test_suite}".freeze
6264

6365
SINGLE_TEST = if ENV['SINGLE_TEST'] && !ENV['SINGLE_TEST'].empty?

0 commit comments

Comments
 (0)