Skip to content

Commit

Permalink
[API] Test Runner: Adds elastic-connectors filter to templates
Browse files Browse the repository at this point in the history
Refactors in wipe_cluster_8
  • Loading branch information
picandocodigo committed Sep 25, 2023
1 parent 1314726 commit 5baf631
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api-spec-testing/wipe_cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions api-spec-testing/wipe_cluster_8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 4 additions & 0 deletions elasticsearch-api/spec/rest_yaml_tests_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch-xpack/spec/xpack/rest_api_yaml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5baf631

Please sign in to comment.