Skip to content

Commit 7d6d0d8

Browse files
committed
[API] Test Runner: Support for skipping "awaits_fix" tests
1 parent 7c9b6af commit 7d6d0d8

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

elasticsearch-api/spec/rest_api/rest_api_yaml_spec.rb

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
require_relative './run_rspec_matchers'
2121

2222
LOGGER = Logger.new($stdout)
23+
CLUSTER_FEATURES = ADMIN_CLIENT.features.get_features['features'].map { |f| f['name'] }
24+
25+
def skip_test?(test)
26+
# To support new features skipping in YAML tests. This will go away with new YAML tests:
27+
if (feature_to_skip = test.skip&.first&.[]('skip')&.[]('cluster_features'))
28+
return true unless CLUSTER_FEATURES.include?(feature_to_skip)
29+
end
30+
# Support skipping 'awaits_fix'
31+
!!test.test_file.instance_variable_get('@skip')&.first&.[]('skip')&.[]('awaits_fix') ||
32+
!!test.skip&.first&.[]('skip')&.[]('awaits_fix')
33+
end
2334

2435
describe 'Rest API YAML tests' do
2536
LOGGER.info "Elastic Transport version: #{Elastic::Transport::VERSION}"
@@ -30,8 +41,6 @@
3041
exit 1
3142
end
3243

33-
CLUSTER_FEATURES = ADMIN_CLIENT.features.get_features['features'].map { |f| f['name'] }
34-
3544
# Traverse YAML files and create TestFile object:
3645
REST_API_YAML_FILES.each do |file|
3746
begin
@@ -48,10 +57,8 @@
4857
let(:client) { DEFAULT_CLIENT }
4958

5059
test_file.tests.each do |test|
51-
# To support new features skipping in YAML tests. This will go away with new YAML tests:
52-
if (feature_to_skip = test.skip&.first&.[]('skip')&.[]('cluster_features'))
53-
next unless CLUSTER_FEATURES.include? feature_to_skip
54-
end
60+
next if skip_test?(test)
61+
5562
context test.description do
5663
if test.skip_test?(ADMIN_CLIENT)
5764
skip 'Test contains feature(s) not yet supported or version is not satisfied'

0 commit comments

Comments
 (0)