Bug Fix:Remove Reaction Index By Name (#10430)
This commit is contained in:
parent
5d110c6fe0
commit
635e9e7365
4 changed files with 23 additions and 23 deletions
|
|
@ -1,10 +0,0 @@
|
|||
module DataUpdateScripts
|
||||
class RemoveReactionIndex
|
||||
def run
|
||||
index_alias = "reactions_#{Rails.env}_alias"
|
||||
return unless Search::Client.indices.exists(index: index_alias)
|
||||
|
||||
Search::Client.indices.delete(index: index_alias)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
module DataUpdateScripts
|
||||
class RemoveReactionIndexByName
|
||||
def run
|
||||
index_name = "reactions_#{Rails.env}"
|
||||
return unless Search::Client.indices.exists(index: index_name)
|
||||
|
||||
Search::Client.indices.delete(index: index_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
require "rails_helper"
|
||||
require Rails.root.join("lib/data_update_scripts/20200924140813_remove_reaction_index_by_name.rb")
|
||||
|
||||
describe DataUpdateScripts::RemoveReactionIndexByName do
|
||||
it "removes reaction index" do
|
||||
index_name = "reactions_#{Rails.env}"
|
||||
Search::Client.indices.create(index: index_name)
|
||||
expect(Search::Client.indices.get(index: "*").keys).to include(index_name)
|
||||
|
||||
described_class.new.run
|
||||
expect(Search::Client.indices.get(index: "*").keys).not_to include(index_name)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
require "rails_helper"
|
||||
require Rails.root.join("lib/data_update_scripts/20200923173148_remove_reaction_index.rb")
|
||||
|
||||
describe DataUpdateScripts::RemoveReactionIndex do
|
||||
it "removes reaction index" do
|
||||
index_alias = "reactions_#{Rails.env}_alias"
|
||||
Search::Client.indices.create(index: index_alias)
|
||||
expect(Search::Client.indices.get(index: "*").keys).to include(index_alias)
|
||||
|
||||
described_class.new.run
|
||||
expect(Search::Client.indices.get(index: "*").keys).not_to include(index_alias)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue