From 26f5f5880edbb08466c9aca5e80892f2cecf2838 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Thu, 7 Sep 2023 13:34:34 +0100 Subject: [PATCH] [API] Test Runner: Refactors test_file to support new version skip format for tests --- elasticsearch-api/api-spec-testing/test_file.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/elasticsearch-api/api-spec-testing/test_file.rb b/elasticsearch-api/api-spec-testing/test_file.rb index a4e88119db..c610b918ff 100644 --- a/elasticsearch-api/api-spec-testing/test_file.rb +++ b/elasticsearch-api/api-spec-testing/test_file.rb @@ -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'] @@ -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]