diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /spec/workers/gitlab_usage_ping_worker_spec.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/workers/gitlab_usage_ping_worker_spec.rb')
-rw-r--r-- | spec/workers/gitlab_usage_ping_worker_spec.rb | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/spec/workers/gitlab_usage_ping_worker_spec.rb b/spec/workers/gitlab_usage_ping_worker_spec.rb deleted file mode 100644 index f282b20363c..00000000000 --- a/spec/workers/gitlab_usage_ping_worker_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe GitlabUsagePingWorker, :clean_gitlab_redis_shared_state do - before do - allow_next_instance_of(SubmitUsagePingService) { |service| allow(service).to receive(:execute) } - allow(subject).to receive(:sleep) - end - - it 'does not run for GitLab.com' do - allow(Gitlab).to receive(:com?).and_return(true) - expect(SubmitUsagePingService).not_to receive(:new) - - subject.perform - end - - it 'delegates to SubmitUsagePingService' do - expect_next_instance_of(SubmitUsagePingService) { |service| expect(service).to receive(:execute) } - - subject.perform - end - - it "obtains a #{described_class::LEASE_TIMEOUT} second exclusive lease" do - expect(Gitlab::ExclusiveLeaseHelpers::SleepingLock) - .to receive(:new) - .with(described_class::LEASE_KEY, hash_including(timeout: described_class::LEASE_TIMEOUT)) - .and_call_original - - subject.perform - end - - it 'sleeps for between 0 and 60 seconds' do - expect(subject).to receive(:sleep).with(0..60) - - subject.perform - end - - context 'when lease is not obtained' do - before do - Gitlab::ExclusiveLease.new(described_class::LEASE_KEY, timeout: described_class::LEASE_TIMEOUT).try_obtain - end - - it 'does not invoke SubmitUsagePingService' do - allow_next_instance_of(SubmitUsagePingService) { |service| expect(service).not_to receive(:execute) } - - expect { subject.perform }.to raise_error(Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError) - end - end -end |