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:
authorStan Hu <stanhu@gmail.com>2019-06-26 00:47:17 +0300
committerStan Hu <stanhu@gmail.com>2019-06-26 01:06:38 +0300
commitd4c87d4dd7a1d7e4d9b38d37b16c85f7326321fc (patch)
tree7602e6ae05f59d2c2b608ec48242253b71515b6a /spec/spec_helper.rb
parent76889a9956e76e300edc8993048c3cd5c3a24da0 (diff)
Disable Rails SQL query cache when applying service templates
When the SQL query cache is active, the SELECT query for finding projects to apply service templates returns the same values. This causes an infinite loop because even though bulk INSERT queries are made, the cached results never reflect that progress. To fix this, we call `Project.uncached` around the query to ensure new data is retrieved. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63595
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 390a869d93f..3bd2408dc72 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -218,6 +218,12 @@ RSpec.configure do |config|
ActionController::Base.cache_store = caching_store
end
+ config.around(:each, :use_sql_query_cache) do |example|
+ ActiveRecord::Base.cache do
+ example.run
+ end
+ end
+
# The :each scope runs "inside" the example, so this hook ensures the DB is in the
# correct state before any examples' before hooks are called. This prevents a
# problem where `ScheduleIssuesClosedAtTypeChange` (or any migration that depends