diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 18:09:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 18:09:30 +0300 |
commit | c6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (patch) | |
tree | 967afee9a510ff9dd503ebd83706dc760ec2e3ed /spec/services/members | |
parent | 903ccf7c93eb9490c76857bffe744249cc07de09 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/members')
-rw-r--r-- | spec/services/members/update_highest_role_service_spec.rb | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/spec/services/members/update_highest_role_service_spec.rb b/spec/services/members/update_highest_role_service_spec.rb deleted file mode 100644 index 6fcb939203d..00000000000 --- a/spec/services/members/update_highest_role_service_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' -require 'sidekiq/testing' - -describe Members::UpdateHighestRoleService, :clean_gitlab_redis_shared_state do - include ExclusiveLeaseHelpers - - let_it_be(:user) { create(:user) } - let_it_be(:lease_key) { "update_highest_role:#{user.id}" } - let(:service) { described_class.new(user.id) } - - describe '#perform' do - subject { service.execute } - - context 'when lease is obtained' do - it 'takes the lease but does not release it', :aggregate_failures do - expect_to_obtain_exclusive_lease(lease_key, 'uuid', timeout: described_class::LEASE_TIMEOUT) - - subject - - expect(service.exclusive_lease.exists?).to be_truthy - end - - it 'schedules a job in the future', :aggregate_failures do - expect(UpdateHighestRoleWorker).to receive(:perform_in).with(described_class::DELAY, user.id).and_call_original - - Sidekiq::Testing.fake! do - expect { subject }.to change(UpdateHighestRoleWorker.jobs, :size).by(1) - end - end - end - - context 'when lease cannot be obtained' do - it 'only schedules one job' do - Sidekiq::Testing.fake! do - stub_exclusive_lease_taken(lease_key, timeout: described_class::LEASE_TIMEOUT) - - expect { subject }.not_to change(UpdateHighestRoleWorker.jobs, :size) - end - end - end - end -end |