diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2018-11-16 15:02:43 +0100 |
---|---|---|
committer | Peter Leitzen <pleitzen@gitlab.com> | 2018-11-23 22:35:38 +0100 |
commit | b47a3a408536b0e4ae6b2dcd81863ded9f52942d (patch) | |
tree | 8f790a557f9f6e02be22d9005946448abeaa2402 /spec/lib/gitlab/prometheus | |
parent | fbbe5ccd1be471a203185c172c51b7137b73f170 (diff) | |
download | gitlab-ce-b47a3a408536b0e4ae6b2dcd81863ded9f52942d.tar.gz |
Extract query variables into own module7527-ci-variables-are-not-parameterized-for-alerting-rules-ce
Diffstat (limited to 'spec/lib/gitlab/prometheus')
-rw-r--r-- | spec/lib/gitlab/prometheus/query_variables_spec.rb | 33 |
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 |