Skip to content

Commit b5d916b

Browse files
committed
[API] Always clear data streams in test runner
Adds xpack as a dependency
1 parent f9516c4 commit b5d916b

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

api-spec-testing/test_file.rb

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,6 @@ class << self
166166
'metrics'
167167
].freeze
168168

169-
XPACK_TEMPLATES = [
170-
'.watches', 'logstash-index-template', '.logstash-management',
171-
'security_audit_log', '.slm-history', '.async-search',
172-
'saml-service-provider', 'ilm-history', 'logs', 'logs-settings',
173-
'logs-mappings', 'metrics', 'metrics-settings', 'metrics-mappings',
174-
'synthetics', 'synthetics-settings', 'synthetics-mappings',
175-
'.snapshot-blob-cache', '.deprecation-indexing-template',
176-
'.deprecation-indexing-mappings', '.deprecation-indexing-settings',
177-
'security-index-template', 'data-streams-mappings'
178-
].freeze
179-
180169
# Wipe Cluster, based on PHP's implementation of ESRestTestCase.java:wipeCluster()
181170
# https://github.com/elastic/elasticsearch-php/blob/7.10/tests/Elasticsearch/Tests/Utility.php#L97
182171
def wipe_cluster(client)
@@ -187,7 +176,7 @@ def wipe_cluster(client)
187176
wipe_searchable_snapshot_indices(client)
188177
end
189178
clear_snapshots_and_repositories(client)
190-
clear_datastreams(client) if xpack?
179+
clear_datastreams(client)
191180
clear_indices(client)
192181
if xpack?
193182
clear_templates_xpack(client)
@@ -304,8 +293,20 @@ def clear_templates_xpack(client)
304293
end
305294
end
306295

296+
XPACK_TEMPLATES = [
297+
'.watches', 'logstash-index-template', '.logstash-management',
298+
'security_audit_log', '.slm-history', '.async-search',
299+
'saml-service-provider', 'ilm-history', 'logs', 'logs-settings',
300+
'logs-mappings', 'metrics', 'metrics-settings', 'metrics-mappings',
301+
'synthetics', 'synthetics-settings', 'synthetics-mappings',
302+
'.snapshot-blob-cache', '.deprecation-indexing-template',
303+
'.deprecation-indexing-mappings', '.deprecation-indexing-settings',
304+
'security-index-template', 'data-streams-mappings'
305+
].freeze
306+
307307
def xpack_template?(template)
308-
xpack_prefixes = ['.monitoring', '.watch', '.triggered-watches', '.data-frame', '.ml-', '.transform', 'data-streams-mappings', '.deprecation-'].freeze
308+
xpack_prefixes = [
309+
'.monitoring', '.watch', '.triggered-watches', '.data-frame', '.ml-', '.transform', 'data-streams-mappings'].freeze
309310
xpack_prefixes.map { |a| return true if a.include? template }
310311

311312
XPACK_TEMPLATES.include? template

elasticsearch-api/elasticsearch-api.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
5050
s.add_development_dependency 'bundler'
5151
s.add_development_dependency 'elasticsearch'
5252
s.add_development_dependency 'elasticsearch-transport'
53+
s.add_development_dependency 'elasticsearch-xpack'
5354
s.add_development_dependency 'minitest'
5455
s.add_development_dependency 'minitest-reporters'
5556
s.add_development_dependency 'mocha'

elasticsearch-api/spec/rest_yaml_tests_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
require "#{File.expand_path(File.dirname('..'), '..')}/api-spec-testing/test_file"
1919
require "#{File.expand_path(File.dirname('..'), '..')}/api-spec-testing/rspec_matchers"
2020
include Elasticsearch::RestAPIYAMLTests
21+
require 'elasticsearch/xpack'
2122

2223
TRANSPORT_OPTIONS = {}
2324
PROJECT_PATH = File.join(File.dirname(__FILE__), '..')

0 commit comments

Comments
 (0)