Skip to content

Commit dc93fed

Browse files
committed
[API] Test Runner: Check for xpack templates when deleting index templates
1 parent 3c2b1c4 commit dc93fed

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

api-spec-testing/test_file.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ def wipe_cluster(client)
184184
clear_ml_jobs(client)
185185
else
186186
client.indices.delete_template(name: '*')
187-
client.indices.delete_index_template(name: '*')
187+
client.indices.get_index_template['index_templates'].each do |template|
188+
next if xpack_template? template['name']
189+
190+
client.indices.delete_index_template(name: template['name'])
191+
end
192+
188193
client.cluster.get_component_template['component_templates'].each do |template|
189194
next if xpack_template? template['name']
190195

@@ -306,7 +311,9 @@ def clear_templates_xpack(client)
306311

307312
def xpack_template?(template)
308313
xpack_prefixes = [
309-
'.monitoring', '.watch', '.triggered-watches', '.data-frame', '.ml-', '.transform', 'data-streams-mappings'].freeze
314+
'.monitoring', '.watch', '.triggered-watches', '.data-frame', '.ml-', '.transform',
315+
'data-streams-mappings'
316+
].freeze
310317
xpack_prefixes.map { |a| return true if a.include? template }
311318

312319
XPACK_TEMPLATES.include? template

0 commit comments

Comments
 (0)