diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-14 12:09:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-14 12:09:25 +0300 |
commit | 3438be0998953aa87854371f42df3c1f47bc2544 (patch) | |
tree | 0a7ff932c9b0ddd62da8f72fb24bd657f02777de /spec/lib/generators | |
parent | ca1dcb848f19e854d2022587436fa5bc5f8ef933 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/generators')
-rw-r--r-- | spec/lib/generators/gitlab/usage_metric_definition/redis_hll_generator_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/generators/gitlab/usage_metric_definition/redis_hll_generator_spec.rb b/spec/lib/generators/gitlab/usage_metric_definition/redis_hll_generator_spec.rb index 4cba9732c22..b6e1d59f6c0 100644 --- a/spec/lib/generators/gitlab/usage_metric_definition/redis_hll_generator_spec.rb +++ b/spec/lib/generators/gitlab/usage_metric_definition/redis_hll_generator_spec.rb @@ -38,6 +38,29 @@ RSpec.describe Gitlab::UsageMetricDefinition::RedisHllGenerator, :silence_stdout expect(monthly_metric_definition["instrumentation_class"]).to eq('RedisHLLMetric') end + context 'with multiple events', :aggregate_failures do + let(:event_2) { 'i_test_event_2' } + let(:args) { [category, event, event_2] } + + it 'creates metric definition files' do + described_class.new(args).invoke_all + + [event, event_2].each do |event| + weekly_metric_definition_path = Dir.glob(File.join(temp_dir, "metrics/counts_7d/*#{event}_weekly.yml")).first + monthly_metric_definition_path = Dir.glob(File.join(temp_dir, "metrics/counts_28d/*#{event}_monthly.yml")).first + + weekly_metric_definition = YAML.safe_load(File.read(weekly_metric_definition_path)) + monthly_metric_definition = YAML.safe_load(File.read(monthly_metric_definition_path)) + + expect(weekly_metric_definition).to include("key_path" => "redis_hll_counters.test_category.#{event}_weekly") + expect(monthly_metric_definition).to include("key_path" => "redis_hll_counters.test_category.#{event}_monthly") + + expect(weekly_metric_definition["instrumentation_class"]).to eq('RedisHLLMetric') + expect(monthly_metric_definition["instrumentation_class"]).to eq('RedisHLLMetric') + end + end + end + context 'with ee option' do let(:weekly_metric_definition_path) { Dir.glob(File.join(temp_dir, 'ee/config/metrics/counts_7d/*i_test_event_weekly.yml')).first } let(:monthly_metric_definition_path) { Dir.glob(File.join(temp_dir, 'ee/config/metrics/counts_28d/*i_test_event_monthly.yml')).first } |