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:
authorPeter Leitzen <pleitzen@gitlab.com>2018-11-16 17:02:43 +0300
committerPeter Leitzen <pleitzen@gitlab.com>2018-11-24 00:35:38 +0300
commitb47a3a408536b0e4ae6b2dcd81863ded9f52942d (patch)
tree8f790a557f9f6e02be22d9005946448abeaa2402 /spec/lib/gitlab/prometheus
parentfbbe5ccd1be471a203185c172c51b7137b73f170 (diff)
Extract query variables into own module
Diffstat (limited to 'spec/lib/gitlab/prometheus')
-rw-r--r--spec/lib/gitlab/prometheus/query_variables_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/prometheus/query_variables_spec.rb b/spec/lib/gitlab/prometheus/query_variables_spec.rb
new file mode 100644
index 00000000000..78974cadb69
--- /dev/null
+++ b/spec/lib/gitlab/prometheus/query_variables_spec.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::Prometheus::QueryVariables do
+ describe '.call' do
+ set(:environment) { create(:environment) }
+ let(:slug) { environment.slug }
+
+ subject { described_class.call(environment) }
+
+ it { is_expected.to include(ci_environment_slug: slug) }
+
+ it do
+ is_expected.to include(environment_filter:
+ %{container_name!="POD",environment="#{slug}"})
+ end
+
+ context 'without deployment platform' do
+ it { is_expected.to include(kube_namespace: '') }
+ end
+
+ context 'with deplyoment platform' do
+ let(:kube_namespace) { environment.deployment_platform.actual_namespace }
+
+ before do
+ create(:cluster, :provided_by_user, projects: [environment.project])
+ end
+
+ it { is_expected.to include(kube_namespace: kube_namespace) }
+ end
+ end
+end