diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /spec/lib/gitlab/usage_data_metrics_spec.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/lib/gitlab/usage_data_metrics_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage_data_metrics_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/lib/gitlab/usage_data_metrics_spec.rb b/spec/lib/gitlab/usage_data_metrics_spec.rb new file mode 100644 index 00000000000..18acd767c6d --- /dev/null +++ b/spec/lib/gitlab/usage_data_metrics_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::UsageDataMetrics do + describe '.uncached_data' do + subject { described_class.uncached_data } + + around do |example| + described_class.instance_variable_set(:@definitions, nil) + example.run + described_class.instance_variable_set(:@definitions, nil) + end + + before do + allow(ActiveRecord::Base.connection).to receive(:transaction_open?).and_return(false) + end + + context 'whith instrumentation_class' do + it 'includes top level keys' do + expect(subject).to include(:uuid) + expect(subject).to include(:hostname) + end + + it 'includes counts keys' do + expect(subject[:counts]).to include(:boards) + end + + it 'includes i_quickactions_approve monthly and weekly key' do + expect(subject[:redis_hll_counters][:quickactions]).to include(:i_quickactions_approve_monthly) + expect(subject[:redis_hll_counters][:quickactions]).to include(:i_quickactions_approve_weekly) + end + + it 'includes counts keys' do + expect(subject[:counts]).to include(:issues) + end + + it 'includes usage_activity_by_stage keys' do + expect(subject[:usage_activity_by_stage][:plan]).to include(:issues) + end + + it 'includes usage_activity_by_stage_monthly keys' do + expect(subject[:usage_activity_by_stage_monthly][:plan]).to include(:issues) + end + end + end +end |