diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /spec/lib/gitlab/job_waiter_spec.rb | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
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') |