mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Change use of Redis flushall to flushdb.
FLUSHALL removes all keys from all databases. Instead we only want to remove keys from the current Redis database.
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
|
||||
if Rails.env.development? && ENV['DISCOURSE_FLUSH_REDIS']
|
||||
puts "Flushing redis (development mode)"
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
@@ -472,7 +472,7 @@ describe DiscourseNarrativeBot::TrackSelector do
|
||||
let(:post) { Fabricate(:post, topic: topic) }
|
||||
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
describe 'when random reply massage has been displayed in the last 6 hours' do
|
||||
|
||||
@@ -237,7 +237,7 @@ describe Auth::DefaultCurrentUserProvider do
|
||||
end
|
||||
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
it "should not update last seen for suspended users" do
|
||||
|
||||
@@ -21,11 +21,11 @@ describe DiscourseRedis do
|
||||
let(:raw_redis) { Redis.new(DiscourseRedis.config) }
|
||||
|
||||
before do
|
||||
raw_redis.flushall
|
||||
raw_redis.flushdb
|
||||
end
|
||||
|
||||
after do
|
||||
raw_redis.flushall
|
||||
raw_redis.flushdb
|
||||
end
|
||||
|
||||
describe 'when namespace is enabled' do
|
||||
|
||||
@@ -5,7 +5,7 @@ require "email/processor"
|
||||
|
||||
describe Email::Processor do
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
let(:from) { "foo@bar.com" }
|
||||
|
||||
@@ -508,7 +508,7 @@ describe PrettyText do
|
||||
['apple', 'banana'].each { |w| Fabricate(:watched_word, word: w, action: WatchedWord.actions[:censor]) }
|
||||
expect(PrettyText.cook("# banana")).not_to include('banana')
|
||||
ensure
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1166,7 +1166,7 @@ HTML
|
||||
end
|
||||
|
||||
describe "censoring" do
|
||||
after(:all) { Discourse.redis.flushall }
|
||||
after(:all) { Discourse.redis.flushdb }
|
||||
|
||||
def expect_cooked_match(raw, expected_cooked)
|
||||
expect(PrettyText.cook(raw)).to eq(expected_cooked)
|
||||
|
||||
@@ -22,7 +22,7 @@ RSpec.describe Jobs::BookmarkReminderNotifications do
|
||||
bookmark1.update_column(:reminder_at, five_minutes_ago - 10.minutes)
|
||||
bookmark2.update_column(:reminder_at, five_minutes_ago - 5.minutes)
|
||||
bookmark3.update_column(:reminder_at, five_minutes_ago)
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
it "sends every reminder and marks the reminder_at to nil for all bookmarks, as well as last sent date" do
|
||||
|
||||
@@ -8,7 +8,7 @@ RSpec.describe BookmarkReminderNotificationHandler do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
describe "#send_notification" do
|
||||
|
||||
@@ -33,7 +33,7 @@ describe Topic do
|
||||
|
||||
describe 'censored words' do
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
describe 'when title contains censored words' do
|
||||
|
||||
@@ -35,7 +35,7 @@ RSpec.describe Admin::BackupsController do
|
||||
end
|
||||
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
|
||||
@paths&.each { |path| File.delete(path) if File.exists?(path) }
|
||||
@paths = nil
|
||||
|
||||
@@ -293,7 +293,7 @@ RSpec.describe Admin::UsersController do
|
||||
fab!(:another_user) { Fabricate(:coding_horror) }
|
||||
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
it "raises an error when the user doesn't have permission" do
|
||||
|
||||
@@ -26,11 +26,11 @@ describe SearchController do
|
||||
before do
|
||||
# TODO be a bit more strategic here instead of junking
|
||||
# all of redis
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
context "when overloaded" do
|
||||
|
||||
@@ -2127,7 +2127,7 @@ RSpec.describe TopicsController do
|
||||
let(:topic) { post.topic }
|
||||
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
it 'returns first post of the topic' do
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe WebhooksController do
|
||||
before { Discourse.redis.flushall }
|
||||
before { Discourse.redis.flushdb }
|
||||
|
||||
let(:email) { "em@il.com" }
|
||||
let(:message_id) { "12345@il.com" }
|
||||
|
||||
@@ -7,7 +7,7 @@ describe WordWatcher do
|
||||
let(:raw) { "Do you like liquorice?\n\nI really like them. One could even say that I am *addicted* to liquorice. Anf if\nyou can mix it up with some anise, then I'm in heaven ;)" }
|
||||
|
||||
after do
|
||||
Discourse.redis.flushall
|
||||
Discourse.redis.flushdb
|
||||
end
|
||||
|
||||
describe '.word_matcher_regexp' do
|
||||
|
||||
Reference in New Issue
Block a user