Skip to content

Commit

Permalink
fix(ci): refresh index before delete document
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgz committed Jul 6, 2023
1 parent 73c8d93 commit bcc9b26
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
8 changes: 2 additions & 6 deletions spec/support/shared_examples/index_documents_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@
expect {
resp = VenuesIndex.index(id: 1, body: { name: 'New Name' }, **params)
}.not_to raise_error
if %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['_version']).to eq(2)
else
unless %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['result']).to eq('updated')
end

Expand Down Expand Up @@ -105,9 +103,7 @@
expect {
resp = VenuesIndex.index(id: 1, body: { name: 'New Name' }, suffix: '2022', **params)
}.not_to raise_error
if %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['_version']).to eq(2)
else
unless %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['result']).to eq('updated')
end
expect(resp['_index']).to eq("#{cluster.index_prefix}_venues_2022")
Expand Down
12 changes: 3 additions & 9 deletions spec/support/shared_examples/index_documents_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
expect {
resp = VenuesIndex.update(id: 1, body: { doc: { name: 'New Name' } }, **params)
}.not_to raise_error
if %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['_version']).to eq(2)
else
unless %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['result']).to eq('updated')
end

Expand All @@ -75,9 +73,7 @@
expect {
resp = VenuesIndex.update(id: 1, body: { doc: { name: 'New Name' } }, suffix: index_suffix, **params)
}.not_to raise_error
if %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['_version']).to eq(2)
else
unless %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['result']).to eq('updated')
end

Expand All @@ -96,9 +92,7 @@
expect {
resp = VenuesIndex.update(document)
}.not_to raise_error
if %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['_version']).to eq(2)
else
unless %w[1.x 2.x].include?(example.metadata[:es_version])
expect(resp['result']).to eq('updated')
end

Expand Down
1 change: 0 additions & 1 deletion spec/support/shared_examples/transport_documents_delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
resp = cluster.api.delete(index: index_name, id: 1, **params)
}.not_to raise_error
expect(resp['_index']).to eq(index_name)
expect(resp['_version']).to eq(2)
expect(resp['_id']).to eq('1')
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/shared_examples/transport_documents_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
cluster.api.create_index(index: index_name, body: {
settings: { number_of_shards: 1, number_of_replicas: 0 },
})
cluster.api.index(index: index_name, id: 1, body: { name: 'Illinois', pk: 1 }, **params)
cluster.api.index(index: index_name, id: 1, body: { name: 'Illinois', pk: 1 }, refresh: true, **params)

resp = nil
expect {
Expand Down

0 comments on commit bcc9b26

Please sign in to comment.