Skip to content

Commit 33115b3

Browse files
authored
Merge pull request #320 from github/jherns/rethrottle-tests
Update tests for rethrottle
2 parents 36cd8b3 + baff7c7 commit 33115b3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/client/reindex_test.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,16 @@
5757
}
5858
response = reindex.reindex(body, requests_per_second: 0.01, wait_for_completion: false)
5959
task_id = response["task"]
60+
node_id = task_id.split(":").first
61+
task_number = task_id.split(":").last.to_i
6062

61-
reindex.rethrottle(task_id, requests_per_second: 1)
63+
response = reindex.rethrottle(task_id, requests_per_second: 1)
6264

63-
tasks = $client.tasks
64-
node_id = task_id.split(":").first
65-
task_id = task_id.split(":").last.to_i
65+
assert_equal 1, response["nodes"][node_id]["tasks"][task_id]["status"]["requests_per_second"]
6666

6767
# wait for the task to complete
68-
tasks.wait_by_id(node_id, task_id, "30s")
68+
tasks = $client.tasks
69+
tasks.wait_by_id(node_id, task_number, "30s")
6970

7071
# Verify that the document has been reindexed
7172
doc = @dest_index.docs.get(id: 1, type: "book")

0 commit comments

Comments
 (0)