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>2018-05-26 00:28:16 +0300
committerStan Hu <stanhu@gmail.com>2018-05-26 08:58:43 +0300
commitb6125f7045d2bed4aadf798dde4c547e2047e039 (patch)
treed8e522ca729b2f755229a6fea2fa0fa9833f154e /spec/views
parent50c8ed2bf498c69d3d52ba1451274e3fbf438429 (diff)
Fix fast admin counters not working when PostgreSQL has secondaries
This commit does a number of things: 1. Reduces the number of queries needed by perform a single query to get all the tuples for the relevant rows. 2. Uses a transaction to query the tuple counts to ensure that the data is retrieved from the primary. Closes #46742
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/admin/dashboard/index.html.haml_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/views/admin/dashboard/index.html.haml_spec.rb b/spec/views/admin/dashboard/index.html.haml_spec.rb
index 59c777ea338..0e8b7c82d3a 100644
--- a/spec/views/admin/dashboard/index.html.haml_spec.rb
+++ b/spec/views/admin/dashboard/index.html.haml_spec.rb
@@ -4,6 +4,11 @@ describe 'admin/dashboard/index.html.haml' do
include Devise::Test::ControllerHelpers
before do
+ counts = Admin::DashboardController::COUNTED_ITEMS.each_with_object({}) do |item, hash|
+ hash[item] = 100
+ end
+
+ assign(:counts, counts)
assign(:projects, create_list(:project, 1))
assign(:users, create_list(:user, 1))
assign(:groups, create_list(:group, 1))