diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-05-17 19:17:15 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-08-04 16:38:48 +0300 |
commit | 3598e60bf20b185b3f8d4e9a88a8eff39c8f729b (patch) | |
tree | ba84a7e7972d4a2563bb79485933fb78462868de /spec/lib/gitlab/cache | |
parent | 990feb9f2b886c5bd0ac37339f149b8e80202019 (diff) |
Add a Circuitbreaker for storage paths
Diffstat (limited to 'spec/lib/gitlab/cache')
-rw-r--r-- | spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb b/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb index f43d89d7ccd..16704ff5e77 100644 --- a/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb +++ b/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb @@ -48,8 +48,9 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do described_class.load_in_batch_for_projects([project_without_status]) end - it 'only connects to redis_cache twice' do - # Once to load, once to store in the cache + it 'only connects to redis twice' do + # Stub circuitbreaker so it doesn't count the redis connections in there + stub_circuit_breaker(project_without_status) expect(Gitlab::Redis::Cache).to receive(:with).exactly(2).and_call_original described_class.load_in_batch_for_projects([project_without_status]) @@ -301,4 +302,13 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do end end end + + def stub_circuit_breaker(project) + fake_circuitbreaker = double + allow(fake_circuitbreaker).to receive(:perform).and_yield + allow(project.repository.raw_repository) + .to receive(:circuit_breaker).and_return(fake_circuitbreaker) + allow(project.repository) + .to receive(:circuit_breaker).and_return(fake_circuitbreaker) + end end |