Skip to content

Commit f147d4a

Browse files
committed
[CI] Test Runner: Pass in admin_client to test_file
1 parent 183cd32 commit f147d4a

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

api-spec-testing/test_file.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class TestFile
3939
# TestFile.new(file_name)
4040
#
4141
# @param [ String ] file_name The name of the test file.
42+
# @param [ Client] An instance of the client
4243
# @param [ Array<Symbol> ] skip_features The names of features to skip.
4344
#
4445
# @since 6.1.0
@@ -105,14 +106,14 @@ def tests
105106
# Run the setup tasks defined for a single test file.
106107
#
107108
# @example Run the setup tasks.
108-
# test_file.setup(client)
109+
# test_file.setup
109110
#
110111
# @param [ Elasticsearch::Client ] client The client to use to perform the setup tasks.
111112
#
112113
# @return [ self ]
113114
#
114115
# @since 6.2.0
115-
def setup(client)
116+
def setup
116117
return unless @setup
117118

118119
actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }
@@ -147,14 +148,14 @@ def setup(client)
147148
# Run the teardown tasks defined for a single test file.
148149
#
149150
# @example Run the teardown tasks.
150-
# test_file.teardown(client)
151+
# test_file.teardown
151152
#
152153
# @param [ Elasticsearch::Client ] client The client to use to perform the teardown tasks.
153154
#
154155
# @return [ self ]
155156
#
156157
# @since 6.2.0
157-
def teardown(client)
158+
def teardown
158159
return unless @teardown
159160

160161
actions = @teardown['teardown'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }

elasticsearch-api/spec/elasticsearch/api/rest_api_yaml_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Traverse YAML files and create TestFile object:
1010
REST_API_YAML_FILES.each do |file|
1111
begin
12-
test_file = Elasticsearch::RestAPIYAMLTests::TestFile.new(file, REST_API_YAML_SKIP_FEATURES)
12+
test_file = Elasticsearch::RestAPIYAMLTests::TestFile.new(file, ADMIN_CLIENT, REST_API_YAML_SKIP_FEATURES)
1313
rescue SkipTestsException => _e
1414
# If the test file has a `skip` at the top level that applies to this
1515
# version of Elasticsearch, continue with the next text.
@@ -29,11 +29,11 @@
2929
# Runs once before each test in a test file
3030
before(:all) do
3131
Elasticsearch::RestAPIYAMLTests::TestFile.wipe_cluster(ADMIN_CLIENT)
32-
test_file.setup(ADMIN_CLIENT)
32+
test_file.setup
3333
end
3434

3535
after(:all) do
36-
test_file.teardown(ADMIN_CLIENT)
36+
test_file.teardown
3737
Elasticsearch::RestAPIYAMLTests::TestFile.wipe_cluster(ADMIN_CLIENT)
3838
end
3939

elasticsearch-xpack/spec/xpack/rest_api_yaml_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
describe 'XPack Rest API YAML tests' do
2222
REST_API_YAML_FILES.each do |file|
2323
begin
24-
test_file = Elasticsearch::RestAPIYAMLTests::TestFile.new(file, DEFAULT_CLIENT, REST_API_YAML_SKIP_FEATURES)
24+
test_file = Elasticsearch::RestAPIYAMLTests::TestFile.new(file, ADMIN_CLIENT, REST_API_YAML_SKIP_FEATURES)
2525
rescue SkipTestsException => _e
2626
# If the test file has a `skip` at the top level that applies to this
2727
# version of Elasticsearch, continue with the next text.
@@ -55,11 +55,11 @@
5555
ADMIN_CLIENT.cluster.put_settings(body: { transient: { "xpack.ml.max_model_memory_limit" => nil } })
5656
ADMIN_CLIENT.cluster.put_settings(body: { persistent: { "xpack.ml.max_model_memory_limit" => nil } })
5757
Elasticsearch::RestAPIYAMLTests::TestFile.wipe_cluster(ADMIN_CLIENT)
58-
test_file.setup(ADMIN_CLIENT)
58+
test_file.setup
5959
end
6060

6161
after(:all) do
62-
test_file.teardown(ADMIN_CLIENT)
62+
test_file.teardown
6363
end
6464

6565
test.task_groups.each do |task_group|

0 commit comments

Comments
 (0)