Skip to content

Commit

Permalink
check status
Browse files Browse the repository at this point in the history
  • Loading branch information
jherns committed Nov 5, 2024
1 parent 4ffa425 commit dcc7552
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/client/reindex_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
before do
@source_index = $client.index("source_index")
@dest_index = $client.index("dest_index")
@non_existent_index = $client.index("non_existent_index")
if @source_index.exists?
@source_index.delete
end
if @dest_index.exists?
@dest_index.delete
end
if @non_existent_index.exists?
@non_existent_index.delete
end
@source_index.create(default_index_settings)
@dest_index.create(default_index_settings)
wait_for_index(@source_index.name, "green")
Expand All @@ -25,6 +29,7 @@
after do
@source_index.delete if @source_index.exists?
@dest_index.delete if @dest_index.exists?
@non_existent_index.delete if @non_existent_index.exists?
end

it "reindexes documents from one index to another" do
Expand All @@ -33,7 +38,7 @@
source: { index: @source_index.name },
dest: { index: @dest_index.name }
}
response = reindex.reindex(body)
reindex.reindex(body)

# Refresh the destination index to make sure the document is searchable
@dest_index.refresh
Expand All @@ -50,8 +55,7 @@
source: { index: @source_index.name },
dest: { index: "non_existent_index" }
}
response = reindex.reindex(body)
puts response
reindex.reindex(body)
new_index = $client.index("non_existent_index")
assert new_index.exists?
end
Expand All @@ -66,5 +70,6 @@
exception = assert_raises(ElastomerClient::Client::RequestError) do
response = reindex.reindex(body)
end
assert_equal(404, exception.status)
end
end

0 comments on commit dcc7552

Please sign in to comment.