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
path: root/spec
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-08-13 13:05:37 +0300
committerNick Thomas <nick@gitlab.com>2019-08-13 13:05:37 +0300
commit35994fe091b65c902c465f3159a3efe881e1df77 (patch)
treefaa5725d18436209756c3a55a7a0ca72e97a6a26 /spec
parent266211b9c4edc308d7c99ed6b80b3a1bd01ff1f3 (diff)
parentdcdc04ab46f4be77db52454dc634593595ae7612 (diff)
Merge branch '65963-avoid-extra-query-allowed-to-uninstall' into 'master'
Fix a performance issue in Helm#can_uninstall? Closes #65963 See merge request gitlab-org/gitlab-ce!31751
Diffstat (limited to 'spec')
-rw-r--r--spec/models/clusters/applications/helm_spec.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/models/clusters/applications/helm_spec.rb b/spec/models/clusters/applications/helm_spec.rb
index d4f8b552088..00b5c72a3d3 100644
--- a/spec/models/clusters/applications/helm_spec.rb
+++ b/spec/models/clusters/applications/helm_spec.rb
@@ -23,7 +23,7 @@ describe Clusters::Applications::Helm do
Clusters::Cluster::APPLICATIONS.keys.each do |application_name|
next if application_name == 'helm'
- it do
+ it "is false when #{application_name} is installed" do
cluster_application = create("clusters_applications_#{application_name}".to_sym)
helm = cluster_application.cluster.application_helm
@@ -31,6 +31,14 @@ describe Clusters::Applications::Helm do
expect(helm.allowed_to_uninstall?).to be_falsy
end
end
+
+ it 'executes a single query only' do
+ cluster_application = create(:clusters_applications_ingress)
+ helm = cluster_application.cluster.application_helm
+
+ query_count = ActiveRecord::QueryRecorder.new { helm.allowed_to_uninstall? }.count
+ expect(query_count).to eq(1)
+ end
end
context "without other existing applications" do