Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-22 21:10:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-22 21:10:13 +0300
commit0a5e00b6914944295b31ce10ffd5429cbe9fae89 (patch)
tree580508961eaa268b13df3eafe6f373b5b500d8c5 /spec/lib/generators
parent5f5f492fe278f3322e9533b617522321e2ccafcc (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_generator_spec.rb27
1 files changed, 22 insertions, 5 deletions
diff --git a/spec/lib/generators/gitlab/usage_metric_definition_generator_spec.rb b/spec/lib/generators/gitlab/usage_metric_definition_generator_spec.rb
index f8c055ae111..74aaf34e82c 100644
--- a/spec/lib/generators/gitlab/usage_metric_definition_generator_spec.rb
+++ b/spec/lib/generators/gitlab/usage_metric_definition_generator_spec.rb
@@ -20,20 +20,37 @@ RSpec.describe Gitlab::UsageMetricDefinitionGenerator do
end
describe 'Creating metric definition file' do
+ let(:sample_metric) { load_sample_metric_definition(filename: sample_filename) }
+
# Stub version so that `milestone` key remains constant between releases to prevent flakiness.
before do
stub_const('Gitlab::VERSION', '13.9.0')
allow(::Gitlab::Usage::Metrics::NamesSuggestions::Generator).to receive(:generate).and_return('test metric name')
end
- let(:sample_metric) { load_sample_metric_definition(filename: 'sample_metric_with_name_suggestions.yml') }
+ context 'without ee option' do
+ let(:sample_filename) { 'sample_metric_with_name_suggestions.yml' }
+ let(:metric_definition_path) { Dir.glob(File.join(temp_dir, 'metrics/counts_7d/*_test_metric.yml')).first }
- it 'creates a metric definition file using the template' do
- described_class.new([key_path], { 'dir' => dir }).invoke_all
+ it 'creates a metric definition file using the template' do
+ described_class.new([key_path], { 'dir' => dir }).invoke_all
+ expect(YAML.safe_load(File.read(metric_definition_path))).to eq(sample_metric)
+ end
+ end
- metric_definition_path = Dir.glob(File.join(temp_dir, 'metrics/counts_7d/*_test_metric.yml')).first
+ context 'with ee option' do
+ let(:sample_filename) { 'sample_metric_with_ee.yml' }
+ let(:metric_definition_path) { Dir.glob(File.join(temp_dir, 'ee/config/metrics/counts_7d/*_test_metric.yml')).first }
- expect(YAML.safe_load(File.read(metric_definition_path))).to eq(sample_metric)
+ before do
+ stub_const("#{described_class}::TOP_LEVEL_DIR", 'config')
+ stub_const("#{described_class}::TOP_LEVEL_DIR_EE", File.join(temp_dir, 'ee'))
+ end
+
+ it 'creates a metric definition file using the template' do
+ described_class.new([key_path], { 'dir' => dir, 'ee': true }).invoke_all
+ expect(YAML.safe_load(File.read(metric_definition_path))).to eq(sample_metric)
+ end
end
end