diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-05 18:08:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-05 18:08:23 +0300 |
commit | 86e1f47cd19e7c164fb0b2c24e28a63ea27ae5ff (patch) | |
tree | 016d11e5f9df14b69e28475641160c8a843cbc34 /spec/services/clusters | |
parent | 38b39c50473ba58a80ddad5c22c96ccd5128ddfb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/clusters')
-rw-r--r-- | spec/services/clusters/applications/prometheus_config_service_spec.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/spec/services/clusters/applications/prometheus_config_service_spec.rb b/spec/services/clusters/applications/prometheus_config_service_spec.rb index 993a697b543..b9032e665ec 100644 --- a/spec/services/clusters/applications/prometheus_config_service_spec.rb +++ b/spec/services/clusters/applications/prometheus_config_service_spec.rb @@ -90,23 +90,25 @@ describe Clusters::Applications::PrometheusConfigService do create(:prometheus_alert, project: project, environment: production, - prometheus_metric: metric) + prometheus_metric: metric, + operator: PrometheusAlert.operators['gt'], + threshold: 0) end let(:metric) do create(:prometheus_metric, query: query, project: project) end - let(:query) { '%{ci_environment_slug}' } + let(:query) { 'up{environment="{{ci_environment_slug}}"}' } it 'substitutes query variables' do expect(Gitlab::Prometheus::QueryVariables) .to receive(:call) - .with(production) + .with(production, start_time: nil, end_time: nil) .and_call_original expr = groups.dig(0, 'rules', 0, 'expr') - expect(expr).to include(production.name) + expect(expr).to eq("up{environment=\"#{production.slug}\"} > 0.0") end end @@ -127,13 +129,15 @@ describe Clusters::Applications::PrometheusConfigService do end it 'substitutes query variables once per environment' do + allow(Gitlab::Prometheus::QueryVariables).to receive(:call).and_call_original + expect(Gitlab::Prometheus::QueryVariables) .to receive(:call) - .with(production) + .with(production, start_time: nil, end_time: nil) expect(Gitlab::Prometheus::QueryVariables) .to receive(:call) - .with(staging) + .with(staging, start_time: nil, end_time: nil) subject end |