Welcome to mirror list, hosted at ThFree Co, Russian Federation.

count_issues_created_manually_from_alerts_metric_spec.rb « instrumentations « metrics « usage « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 56b847257a5c20869a7e03a9b4baded09a9be2f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CountIssuesCreatedManuallyFromAlertsMetric,
  feature_category: :service_ping do
  let_it_be(:issue) { create(:issue) }
  let_it_be(:issue_with_alert) { create(:issue, :with_alert) }

  let(:expected_value) { 1 }
  let(:expected_query) do
    'SELECT COUNT("issues"."id") FROM "issues" ' \
      'INNER JOIN "alert_management_alerts" ON "alert_management_alerts"."issue_id" = "issues"."id" ' \
      'WHERE "issues"."author_id" != 99'
  end

  it_behaves_like 'a correct instrumented metric value', { time_frame: 'all', data_source: 'database' }

  context 'on SaaS', :saas do
    let(:expected_value) { -1 }

    it_behaves_like 'a correct instrumented metric value', { time_frame: 'all', data_source: 'database' }
  end
end