Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Test Runner: Refactors test_file to support new version skip format for tests #2215

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions elasticsearch-api/api-spec-testing/test_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ def skip_entire_test_file?(file_name)
def skip_version?(client, skip_definition)
return true if skip_definition.fetch('version', '').include? 'all'

range_partition = /\s*-\s*/
return unless (versions = skip_definition['version'])

low, high = __parse_versions(versions.partition(range_partition))
low, high = __parse_versions(versions)
range = low..high
begin
server_version = client.info['version']['number']
Expand All @@ -90,7 +89,13 @@ def skip_version?(client, skip_definition)
end

def __parse_versions(versions)
versions = versions.split('-') if versions.is_a? String
if versions.count('-') == 2
versions = versions.gsub(/\s/, '').gsub(/-/, '').split(',')
else
range_partition = /\s*-\s*/
versions = versions.partition(range_partition)
versions = versions.split('-') if versions.is_a? String
end

low = (['', nil].include? versions[0]) ? '0' : versions[0]
high = (['', nil].include? versions[2]) ? '9999' : versions[2]
Expand Down
Loading