diff --git a/api-spec-testing/wipe_cluster.rb b/api-spec-testing/wipe_cluster.rb index cd11be7f30..8b0e32780c 100644 --- a/api-spec-testing/wipe_cluster.rb +++ b/api-spec-testing/wipe_cluster.rb @@ -177,9 +177,9 @@ def clear_templates_xpack(client) def xpack_template?(template) xpack_prefixes = [ '.monitoring', '.watch', '.triggered-watches', '.data-frame', '.ml-', '.transform', - 'data-streams-mappings' + 'data-streams-mappings', 'elastic-connectors' ].freeze - xpack_prefixes.map { |a| return true if a.include? template } + xpack_prefixes.map { |a| return true if (a.include?(template) || template.start_with?(a)) } XPACK_TEMPLATES.include? template end diff --git a/api-spec-testing/wipe_cluster_8.rb b/api-spec-testing/wipe_cluster_8.rb index 00ea55376f..33b0b26180 100644 --- a/api-spec-testing/wipe_cluster_8.rb +++ b/api-spec-testing/wipe_cluster_8.rb @@ -242,9 +242,9 @@ def wipe_all_templates(client) def platinum_template?(template) platinum_prefixes = [ '.monitoring', '.watch', '.triggered-watches', '.data-frame', '.ml-', '.transform', - 'data-streams-mappings' + 'data-streams-mappings', 'elastic-connectors' ].freeze - platinum_prefixes.map { |a| return true if a.include? template } + platinum_prefixes.map { |a| return true if (a.include?(template) || template.start_with?(a)) } PLATINUM_TEMPLATES.include? template end @@ -261,7 +261,7 @@ def wait_for_cluster_tasks(client) logger.debug "Pending cluster task: #{task}" count += 1 end - break unless count.positive? && Time.now.to_i < (time + 30) + break unless count.positive? && Time.now.to_i < (time + 10) end end diff --git a/elasticsearch-api/spec/rest_yaml_tests_helper.rb b/elasticsearch-api/spec/rest_yaml_tests_helper.rb index 010af11459..a936ac894f 100644 --- a/elasticsearch-api/spec/rest_yaml_tests_helper.rb +++ b/elasticsearch-api/spec/rest_yaml_tests_helper.rb @@ -25,6 +25,10 @@ STACK_VERSION = ENV['STACK_VERSION'] require 'elasticsearch/xpack' +def testing_compatibility? + [1, true, 'true'].include?(ENV['ELASTIC_CLIENT_APIVERSIONING']) +end + if (hosts = ELASTICSEARCH_URL) split_hosts = hosts.split(',').map do |host| /(http\:\/\/)?\S+/.match(host) diff --git a/elasticsearch-xpack/spec/xpack/rest_api_yaml_spec.rb b/elasticsearch-xpack/spec/xpack/rest_api_yaml_spec.rb index 3514c2a0ae..090d393004 100644 --- a/elasticsearch-xpack/spec/xpack/rest_api_yaml_spec.rb +++ b/elasticsearch-xpack/spec/xpack/rest_api_yaml_spec.rb @@ -41,7 +41,7 @@ context ctx do before(:all) do # Runs once before all tests in a test file - if [true, 'true'].include?(ENV['ELASTIC_CLIENT_APIVERSIONING']) + if testing_compatibility? Elasticsearch::RestAPIYAMLTests::WipeCluster8.run(ADMIN_CLIENT) else Elasticsearch::RestAPIYAMLTests::WipeCluster.run(ADMIN_CLIENT) @@ -70,7 +70,7 @@ after(:all) do test_file.teardown - if [true, 'true'].include?(ENV['ELASTIC_CLIENT_APIVERSIONING']) + if testing_compatibility? Elasticsearch::RestAPIYAMLTests::WipeCluster8.run(ADMIN_CLIENT) else Elasticsearch::RestAPIYAMLTests::WipeCluster.run(ADMIN_CLIENT)