summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/artifacts/metrics_spec.rb
blob: 0ce76285b03f6c5b812087649fa0886516163815 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Ci::Artifacts::Metrics, :prometheus do
  let(:metrics) { described_class.new }

  describe '#increment_destroyed_artifacts' do
    context 'when incrementing by more than one' do
      let(:counter) { metrics.send(:destroyed_artifacts_counter) }

      it 'increments a single counter' do
        subject.increment_destroyed_artifacts_count(10)
        subject.increment_destroyed_artifacts_count(20)
        subject.increment_destroyed_artifacts_count(30)

        expect(counter.get).to eq 60
        expect(counter.values.count).to eq 1
      end
    end
  end
end