2021-04-17 20:07:23 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
# If this spec fails, we need to add the new code review event to the correct aggregated metric
|
|
|
|
RSpec.describe 'Code review events' do
|
|
|
|
it 'the aggregated metrics contain all the code review metrics' do
|
2021-04-29 21:17:54 +05:30
|
|
|
path = Rails.root.join('config/metrics/aggregates/code_review.yml')
|
2021-04-17 20:07:23 +05:30
|
|
|
aggregated_events = YAML.safe_load(File.read(path), aliases: true)&.map(&:with_indifferent_access)
|
|
|
|
|
|
|
|
code_review_aggregated_events = aggregated_events
|
|
|
|
.map { |event| event['events'] }
|
|
|
|
.flatten
|
|
|
|
.uniq
|
|
|
|
|
|
|
|
code_review_events = Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category("code_review")
|
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
exceptions = %w[i_code_review_mr_diffs i_code_review_mr_single_file_diffs i_code_review_total_suggestions_applied i_code_review_total_suggestions_added]
|
2021-04-17 20:07:23 +05:30
|
|
|
code_review_aggregated_events += exceptions
|
|
|
|
|
|
|
|
expect(code_review_events - code_review_aggregated_events).to be_empty
|
|
|
|
end
|
|
|
|
end
|