diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/lib/gitlab/job_waiter_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-13.5.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/lib/gitlab/job_waiter_spec.rb')
-rw-r--r-- | spec/lib/gitlab/job_waiter_spec.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/spec/lib/gitlab/job_waiter_spec.rb b/spec/lib/gitlab/job_waiter_spec.rb index 7aa0a3485fb..a9edb2b530b 100644 --- a/spec/lib/gitlab/job_waiter_spec.rb +++ b/spec/lib/gitlab/job_waiter_spec.rb @@ -2,23 +2,26 @@ require 'spec_helper' -RSpec.describe Gitlab::JobWaiter do +RSpec.describe Gitlab::JobWaiter, :redis do describe '.notify' do it 'pushes the jid to the named queue' do - key = 'gitlab:job_waiter:foo' - jid = 1 + key = described_class.new.key - redis = double('redis') - expect(Gitlab::Redis::SharedState).to receive(:with).and_yield(redis) - expect(redis).to receive(:lpush).with(key, jid) + described_class.notify(key, 123) - described_class.notify(key, jid) + Gitlab::Redis::SharedState.with do |redis| + expect(redis.ttl(key)).to be > 0 + end end end describe '#wait' do let(:waiter) { described_class.new(2) } + before do + allow_any_instance_of(described_class).to receive(:wait).and_call_original + end + it 'returns when all jobs have been completed' do described_class.notify(waiter.key, 'a') described_class.notify(waiter.key, 'b') |