summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-01-21 02:38:58 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-01-21 02:38:58 +0800
commit7a4d723e6ba287fe792dca0a8ddc3d8a77b1876c (patch)
tree3736e8a74bddc028b9588510bcb87bb535ac4c5c /spec/models
parent7a109402a866db1c84ef9af1c14e148ec944aa22 (diff)
downloadgitlab-ce-7a4d723e6ba287fe792dca0a8ddc3d8a77b1876c.tar.gz
Remove the key from the queue when runner is deleted
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/runner_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index 7b993a454b7..6283673d7ae 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -319,6 +319,25 @@ describe Ci::Runner, models: true do
end
end
+ describe '#destroy' do
+ let(:runner) { create(:ci_runner) }
+
+ context 'when there is a tick in the queue' do
+ let!(:queue_key) { runner.send(:runner_queue_key) }
+
+ before do
+ runner.tick_runner_queue
+ runner.destroy
+ end
+
+ it 'cleans up the queue' do
+ Gitlab::Redis.with do |redis|
+ expect(redis.get(queue_key)).to be_nil
+ end
+ end
+ end
+ end
+
describe '.assignable_for' do
let(:runner) { create(:ci_runner) }
let(:project) { create(:project) }