Skip to content

Commit

Permalink
Merge pull request #320 from github/jherns/rethrottle-tests
Browse files Browse the repository at this point in the history
Update tests for rethrottle
  • Loading branch information
jherns authored Dec 12, 2024
2 parents 36cd8b3 + baff7c7 commit 33115b3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/client/reindex_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 33115b3

Please sign in to comment.