From baff7c751db5f78f78e9252db6afa8a9bfc6c171 Mon Sep 17 00:00:00 2001 From: John Hernley Date: Wed, 11 Dec 2024 16:40:48 +0000 Subject: [PATCH] add tests --- test/client/reindex_test.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/client/reindex_test.rb b/test/client/reindex_test.rb index a41eafef..f3b00e3e 100644 --- a/test/client/reindex_test.rb +++ b/test/client/reindex_test.rb @@ -57,15 +57,16 @@ } response = reindex.reindex(body, requests_per_second: 0.01, wait_for_completion: false) task_id = response["task"] + node_id = task_id.split(":").first + task_number = task_id.split(":").last.to_i - reindex.rethrottle(task_id, requests_per_second: 1) + response = reindex.rethrottle(task_id, requests_per_second: 1) - tasks = $client.tasks - node_id = task_id.split(":").first - task_id = task_id.split(":").last.to_i + assert_equal 1, response["nodes"][node_id]["tasks"][task_id]["status"]["requests_per_second"] # wait for the task to complete - tasks.wait_by_id(node_id, task_id, "30s") + tasks = $client.tasks + tasks.wait_by_id(node_id, task_number, "30s") # Verify that the document has been reindexed doc = @dest_index.docs.get(id: 1, type: "book")