Skip to content

Commit f4f88f9

Browse files
committed
[Test Runner] Refactors skippable tasks when waiting for pending
1 parent 03fba60 commit f4f88f9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

elasticsearch-api/api-spec-testing/wipe_cluster.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def wait_for_pending_rollup_tasks(client)
156156

157157
time = Time.now.to_i
158158
results.each do |task|
159-
next if task.empty?
159+
next if task.empty? || skippable_task?(task)
160160

161161
logger.debug("Pending task: #{task}")
162162
count += 1 if task.include?(filter)
@@ -277,8 +277,8 @@ def wait_for_cluster_tasks(client)
277277
loop do
278278
results = client.cluster.pending_tasks
279279
results['tasks'].each do |task|
280-
names = ['health-node', 'cluster:monitor/tasks/lists', 'create-index-template-v2']
281-
next if task.empty? || names.select { |n| task['source'].match? n }.any?
280+
281+
next if task.empty? || skippable_task?(task)
282282

283283
logger.debug "Pending cluster task: #{task}"
284284
count += 1
@@ -287,6 +287,16 @@ def wait_for_cluster_tasks(client)
287287
end
288288
end
289289

290+
def skippable_task?(task)
291+
names = ['health-node', 'cluster:monitor/tasks/lists', 'create-index-template-v2',
292+
'remove-component-template']
293+
if task.is_a?(String)
294+
names.select { |n| task.match? n }.any?
295+
elsif task.is_a?(Hash)
296+
names.select { |n| task['source'].match? n }.any?
297+
end
298+
end
299+
290300
def delete_all_ilm_policies(client)
291301
policies = client.ilm.get_lifecycle
292302
policies.each do |policy|

0 commit comments

Comments
 (0)