Merge pull request 'Isolate remoteStorage Redis specs from concurrent runs' (#261) from fix/rs-redis-flake into master
CI / Test (push) Successful in 42s
CI / Test (push) Successful in 42s
Reviewed-on: #261
This commit was merged in pull request #261.
This commit is contained in:
2 files changed
+1
-14
No files matched your search
@@ -11,9 +11,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
end
|
||||
|
||||
describe "#create" do
|
||||
before(:each) { redis_rs_delete_keys("authorizations:*") }
|
||||
after(:each) { clear_enqueued_jobs }
|
||||
after(:all) { redis_rs_delete_keys("authorizations:*") }
|
||||
|
||||
let(:auth) do
|
||||
user.remote_storage_authorizations.create!(
|
||||
@@ -49,7 +47,6 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
|
||||
describe "#destroy" do
|
||||
after(:each) { clear_enqueued_jobs }
|
||||
after(:all) { redis_rs_delete_keys("authorizations:*") }
|
||||
|
||||
it "removes the token from redis" do
|
||||
auth = user.remote_storage_authorizations.create!(
|
||||
@@ -59,7 +56,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
)
|
||||
auth.destroy!
|
||||
|
||||
expect(redis_rs.keys("authorizations:#{user.address}:*")).to be_empty
|
||||
expect(redis_rs.exists?("authorizations:#{user.cn}:#{auth.token}")).to be(false)
|
||||
end
|
||||
|
||||
context "with expiry set" do
|
||||
@@ -79,8 +76,6 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
|
||||
describe "#find_or_create_web_app" do
|
||||
context "with origin that looks hosted" do
|
||||
after(:all) { redis_rs_delete_keys("authorizations:*") }
|
||||
|
||||
let(:auth) do
|
||||
user.remote_storage_authorizations.create!(
|
||||
permissions: %w(documents:rw),
|
||||
@@ -173,8 +168,6 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
end
|
||||
|
||||
describe "#launch_url" do
|
||||
after(:all) { redis_rs_delete_keys("authorizations:*") }
|
||||
|
||||
context "without start URL" do
|
||||
before do
|
||||
AppCatalog::WebApp.create!(
|
||||
@@ -250,7 +243,6 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
include ActiveJob::TestHelper
|
||||
|
||||
after(:each) { clear_enqueued_jobs }
|
||||
after(:all) { redis_rs_delete_keys("authorizations:*") }
|
||||
|
||||
before { allow(user).to receive(:display_name).and_return("Jimmy") }
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
def redis_rs
|
||||
@redis_rs ||= Redis.new(url: Setting.rs_redis_url)
|
||||
end
|
||||
|
||||
def redis_rs_delete_keys(pattern)
|
||||
keys = redis_rs.keys(pattern)
|
||||
redis_rs.del(*keys)
|
||||
end
|
||||
Reference in new issue
Block a user