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:
Alan Guo Xiang Tan
2024-10-09 07:19:31 +08:00
committed by GitHub
parent 44fe8c62d6
commit ed6c9d1545
38 changed files with 10 additions and 154 deletions

View File

@ -380,8 +380,6 @@ RSpec.describe UsersController do
context "with rate limiting" do
before { RateLimiter.enable }
use_redis_snapshotting
it "rate limits reset passwords" do
freeze_time
@ -4410,8 +4408,6 @@ RSpec.describe UsersController do
end
context "with a session variable" do
use_redis_snapshotting
it "raises an error with an invalid session value" do
post_user
@ -5625,8 +5621,6 @@ RSpec.describe UsersController do
describe "#enable_second_factor_totp" do
before { sign_in(user1) }
use_redis_snapshotting
def create_totp
stub_secure_session_confirmed
post "/users/create_second_factor_totp.json"