Remove old model specific search index workers (#6297) [deploy]

This commit is contained in:
Alex 2020-02-25 13:49:56 -08:00 committed by GitHub
parent afea3c97f0
commit 4b5bee0ac9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 101 deletions

View file

@ -1,12 +0,0 @@
module Search
class ChatChannelMembershipEsIndexWorker
include Sidekiq::Worker
sidekiq_options queue: :high_priority
def perform(chat_channel_membership_id)
chat_channel_membership = ::ChatChannelMembership.find(chat_channel_membership_id)
chat_channel_membership.index_to_elasticsearch_inline
end
end
end

View file

@ -1,12 +0,0 @@
module Search
class ClassifiedListingEsIndexWorker
include Sidekiq::Worker
sidekiq_options queue: :high_priority
def perform(classified_listing_id)
classified_listing = ::ClassifiedListing.find(classified_listing_id)
classified_listing.index_to_elasticsearch_inline
end
end
end

View file

@ -1,12 +0,0 @@
module Search
class TagEsIndexWorker
include Sidekiq::Worker
sidekiq_options queue: :high_priority
def perform(tag_id)
tag = ::Tag.find(tag_id)
tag.index_to_elasticsearch_inline
end
end
end

View file

@ -1,21 +0,0 @@
require "rails_helper"
RSpec.describe Search::ChatChannelMembershipEsIndexWorker, type: :worker, elasticsearch: true do
let(:worker) { subject }
include_examples "#enqueues_on_correct_queue", "high_priority", [1]
it "raises an error if record is not found" do
expect { worker.perform(1234) }.to raise_error(ActiveRecord::RecordNotFound)
end
it "indexes chat_channel_membership" do
chat_channel_membership = FactoryBot.create(:chat_channel_membership)
expect { chat_channel_membership.elasticsearch_doc }.to raise_error(Search::Errors::Transport::NotFound)
worker.perform(chat_channel_membership.id)
expected_hash = chat_channel_membership.serialized_search_hash.stringify_keys
expect(chat_channel_membership.elasticsearch_doc.dig("_source")).to include(
expected_hash,
)
end
end

View file

@ -1,24 +0,0 @@
require "rails_helper"
RSpec.describe Search::ClassifiedListingEsIndexWorker, type: :worker, elasticsearch: true do
let(:worker) { subject }
include_examples "#enqueues_on_correct_queue", "high_priority", [1]
it "raises an error if record is not found" do
expect { worker.perform(1234) }.to raise_error(ActiveRecord::RecordNotFound)
end
it "indexes classified_listing" do
classified_listing = FactoryBot.create(:classified_listing)
expect { classified_listing.elasticsearch_doc }.to raise_error(Search::Errors::Transport::NotFound)
worker.perform(classified_listing.id)
elasticsearch_doc = classified_listing.elasticsearch_doc.dig("_source").deep_symbolize_keys
cl_serialized_search_hash = classified_listing.serialized_search_hash.deep_symbolize_keys
expect(elasticsearch_doc[:id]).to eq(cl_serialized_search_hash[:id])
expect(elasticsearch_doc[:author][:name]).to eq(cl_serialized_search_hash[:author][:name])
expect(elasticsearch_doc[:body_markdown]).to eq(cl_serialized_search_hash[:body_markdown])
end
end

View file

@ -1,20 +0,0 @@
require "rails_helper"
RSpec.describe Search::TagEsIndexWorker, type: :worker, elasticsearch: true do
let(:worker) { subject }
include_examples "#enqueues_on_correct_queue", "high_priority", [1]
it "raises an error if record is not found" do
expect { worker.perform(1234) }.to raise_error(ActiveRecord::RecordNotFound)
end
it "indexes tag" do
tag = FactoryBot.create(:tag)
expect { tag.elasticsearch_doc }.to raise_error(Search::Errors::Transport::NotFound)
worker.perform(tag.id)
expect(tag.elasticsearch_doc.dig("_source")).to eq(
tag.serialized_search_hash.stringify_keys,
)
end
end