Commit 23d80005 authored by Thong Kuah's avatar Thong Kuah

Merge branch '241260-core-improve-spec-runtime-for-core' into 'master'

Improve  runtime of usage data core specs

See merge request gitlab-org/gitlab!41744
parents 6123685d a68822c4
......@@ -12,14 +12,14 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
describe '.uncached_data' do
describe '.usage_activity_by_stage' do
it 'includes usage_activity_by_stage data' do
uncached_data = described_class.uncached_data
subject { described_class.uncached_data }
expect(uncached_data).to include(:usage_activity_by_stage)
expect(uncached_data).to include(:usage_activity_by_stage_monthly)
expect(uncached_data[:usage_activity_by_stage])
it 'includes usage_activity_by_stage data' do
is_expected.to include(:usage_activity_by_stage)
is_expected.to include(:usage_activity_by_stage_monthly)
expect(subject[:usage_activity_by_stage])
.to include(:configure, :create, :manage, :monitor, :plan, :release, :verify)
expect(uncached_data[:usage_activity_by_stage_monthly])
expect(subject[:usage_activity_by_stage_monthly])
.to include(:configure, :create, :manage, :monitor, :plan, :release, :verify)
end
......@@ -34,15 +34,13 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(described_class).to receive(:clear_memoization).with(key)
end
described_class.uncached_data
subject
end
it 'merge_requests_users is included only in montly counters' do
uncached_data = described_class.uncached_data
expect(uncached_data[:usage_activity_by_stage][:create])
expect(subject[:usage_activity_by_stage][:create])
.not_to include(:merge_requests_users)
expect(uncached_data[:usage_activity_by_stage_monthly][:create])
expect(subject[:usage_activity_by_stage_monthly][:create])
.to include(:merge_requests_users)
end
end
......@@ -401,10 +399,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(UsageDataHelpers::COUNTS_KEYS - count_data.keys).to be_empty
end
it 'gathers usage counts monthly hash' do
expect(subject[:counts_monthly]).to be_an(Hash)
end
it 'gathers usage counts correctly' do
count_data = subject[:counts]
......@@ -492,10 +486,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
)
end
it 'gathers topology data' do
expect(subject.keys).to include(:topology)
end
context 'with existing container expiration policies' do
let_it_be(:disabled) { create(:container_expiration_policy, enabled: false) }
let_it_be(:enabled) { create(:container_expiration_policy, enabled: true) }
......
......@@ -138,6 +138,7 @@ module UsageDataHelpers
USAGE_DATA_KEYS = %i(
active_user_count
counts
counts_monthly
recorded_at
edition
version
......@@ -162,6 +163,7 @@ module UsageDataHelpers
web_ide_clientside_preview_enabled
ingress_modsecurity_enabled
object_store
topology
).freeze
def stub_usage_data_connections
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment