debian-mirror-gitlab/spec/lib/gitlab/ci/parsers/instrumentation_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
694 B
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# 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
2023-04-23 21:23:45 +05:30
def parse!(arg1, arg2:)
2021-03-11 19:13:27 +05:30
"parse #{arg1} #{arg2}"
end
end
end
it 'sets metrics for duration of parsing' do
2023-04-23 21:23:45 +05:30
result = parser_class.new.parse!('hello', arg2: 'world')
2021-03-11 19:13:27 +05:30
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