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

instrumentation_spec.rb « parsers « ci « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 30bcce21be257111bffe9c929258ff4190311042 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Ci::Parsers::Instrumentation do
  describe '#parse!' do
    let(:parser_class) do
      Class.new do
        prepend Gitlab::Ci::Parsers::Instrumentation

        def parse!(arg1, arg2)
          "parse #{arg1} #{arg2}"
        end
      end
    end

    it 'sets metrics for duration of parsing' do
      result = parser_class.new.parse!('hello', 'world')

      expect(result).to eq('parse hello world')

      metrics = Gitlab::Metrics.registry.get(:ci_report_parser_duration_seconds).get({ parser: parser_class.name })

      expect(metrics.keys).to match_array(described_class::BUCKETS)
    end
  end
end