Skip to content

Commit 0f070b4

Browse files
committed
[API] Test Runner: Supports new skip by feature in YAML tests
1 parent 5c87e0c commit 0f070b4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def split_and_parse_key(key)
7171
end
7272
end
7373

74-
attr_reader :description, :test_file, :cached_values, :file_basename
74+
attr_reader :description, :test_file, :cached_values, :file_basename, :skip
7575

7676
# Actions that if followed by a 'do' action, indicate that they complete their task group.
7777
# For example, consider this sequence of actions:

elasticsearch-api/spec/rest_api/rest_api_yaml_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
exit 1
3131
end
3232

33+
CLUSTER_FEATURES = ADMIN_CLIENT.features.get_features['features'].map { |f| f['name'] }
34+
3335
# Traverse YAML files and create TestFile object:
3436
REST_API_YAML_FILES.each do |file|
3537
begin
@@ -46,6 +48,10 @@
4648
let(:client) { DEFAULT_CLIENT }
4749

4850
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
4955
context test.description do
5056
if test.skip_test?(ADMIN_CLIENT)
5157
skip 'Test contains feature(s) not yet supported or version is not satisfied'

0 commit comments

Comments
 (0)