mirror of
https://github.com/discourse/discourse.git
synced 2025-06-28 13:21:47 +08:00
DEV: Call Discourse.redis.flushdb after the end of each test (#29117)
There have been too many flaky tests as a result of leaking state in Redis so it is easier to resolve them by ensuring we flush Redis' database. Locally on my machine, calling `Discourse.redis.flushdb` takes around 0.1ms which means this change will have very little impact on test runtimes.
This commit is contained in:

committed by
GitHub

parent
44fe8c62d6
commit
ed6c9d1545
@ -3,14 +3,16 @@
|
||||
describe Jobs::Chat::ProcessMessage do
|
||||
fab!(:chat_message) { Fabricate(:chat_message, message: "https://discourse.org/team") }
|
||||
|
||||
it "updates cooked with oneboxes" do
|
||||
before do
|
||||
stub_request(:get, "https://discourse.org/team").to_return(
|
||||
status: 200,
|
||||
body: "<html><head><title>a</title></head></html>",
|
||||
)
|
||||
|
||||
stub_request(:head, "https://discourse.org/team").to_return(status: 200)
|
||||
end
|
||||
|
||||
it "updates cooked with oneboxes" do
|
||||
described_class.new.execute(chat_message_id: chat_message.id)
|
||||
expect(chat_message.reload.cooked).to eq(
|
||||
"<p><a href=\"https://discourse.org/team\" class=\"onebox\" target=\"_blank\" rel=\"noopener nofollow ugc\">https://discourse.org/team</a></p>",
|
||||
|
@ -72,8 +72,6 @@ RSpec.describe Chat::IncomingWebhooksController do
|
||||
end
|
||||
|
||||
describe "rate limiting" do
|
||||
use_redis_snapshotting
|
||||
|
||||
it "rate limits" do
|
||||
RateLimiter.enable
|
||||
10.times { post "/chat/hooks/#{webhook.key}.json", params: valid_payload }
|
||||
|
Reference in New Issue
Block a user