Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-06-28 12:39:29 +0300
committerPaco Guzman <pacoguzmanp@gmail.com>2016-06-30 17:17:38 +0300
commit5fe85bc8cae98d6996907fd5ce86760b72319306 (patch)
tree8e1cd4655027a87dc242efb6050e674e5d5aba21 /spec/models
parent99e5ae10bebfcb8e26117426bb773fcd531c45f1 (diff)
Expire branch/tag git data when needed.
When pushing commits to existing branches we don’t need to flush branch git data (branch names / counts) When flushes the cache when pushing commits skip to flush branch and tag git data (names / counts) because those operations are managed explicitly in each case Repopulated expired cache as soon as possible
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/repository_spec.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index d8350000bf6..8ae083d7132 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -531,8 +531,6 @@ describe Repository, models: true do
describe '#expire_cache' do
it 'expires all caches' do
expect(repository).to receive(:expire_branch_cache)
- expect(repository).to receive(:expire_branch_count_cache)
- expect(repository).to receive(:expire_tag_count_cache)
repository.expire_cache
end
@@ -1055,12 +1053,14 @@ describe Repository, models: true do
let(:cache) { repository.send(:cache) }
it 'builds the caches if they do not already exist' do
+ cache_keys = repository.cache_keys + repository.cache_keys_for_branches_and_tags
+
expect(cache).to receive(:exist?).
- exactly(repository.cache_keys.length).
+ exactly(cache_keys.length).
times.
and_return(false)
- repository.cache_keys.each do |key|
+ cache_keys.each do |key|
expect(repository).to receive(key)
end
@@ -1068,12 +1068,14 @@ describe Repository, models: true do
end
it 'does not build any caches that already exist' do
+ cache_keys = repository.cache_keys + repository.cache_keys_for_branches_and_tags
+
expect(cache).to receive(:exist?).
- exactly(repository.cache_keys.length).
+ exactly(cache_keys.length).
times.
and_return(true)
- repository.cache_keys.each do |key|
+ cache_keys.each do |key|
expect(repository).not_to receive(key)
end