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

distinct_count_projects_with_expiration_policy_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: a1ca658a0d786e883c5629c0788d02b493f5bb4c (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
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Usage::Metrics::Instrumentations::DistinctCountProjectsWithExpirationPolicyMetric do
  before_all do
    create(:container_expiration_policy, enabled: false)
    create(:container_expiration_policy, enabled: false, created_at: 29.days.ago)
    create(:container_expiration_policy, keep_n: nil)
    create(:container_expiration_policy, keep_n: 5, enabled: true)
    create(:container_expiration_policy, keep_n: 5, enabled: true)
    create(:container_expiration_policy, keep_n: 5, enabled: true)
    create(:container_expiration_policy, older_than: '7d')
    create(:container_expiration_policy, cadence: '14d')
    create(:container_expiration_policy, enabled: true)
  end

  it_behaves_like 'a correct instrumented metric value', { time_frame: '28d', options: { enabled: false } } do
    let(:expected_value) { 1 }
  end

  it_behaves_like 'a correct instrumented metric value', { time_frame: 'all', options: { enabled: false } } do
    let(:expected_value) { 2 }
  end

  it_behaves_like 'a correct instrumented metric value', { time_frame: 'all', options: { keep_n: 5, enabled: true } } do
    let(:expected_value) { 3 }
  end

  it_behaves_like 'a correct instrumented metric value', { time_frame: 'all', options: { cadence: '14d' } } do
    let(:expected_value) { 1 }
  end
end