diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/lib/gitlab/usage/metric_definition_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/usage/metric_definition_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage/metric_definition_spec.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/lib/gitlab/usage/metric_definition_spec.rb b/spec/lib/gitlab/usage/metric_definition_spec.rb index 92e51b8ea23..1ed639b2f7d 100644 --- a/spec/lib/gitlab/usage/metric_definition_spec.rb +++ b/spec/lib/gitlab/usage/metric_definition_spec.rb @@ -44,7 +44,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do end it 'has all definitons valid' do - expect { described_class.definitions }.not_to raise_error(Gitlab::Usage::Metric::InvalidMetricError) + expect { described_class.definitions }.not_to raise_error end describe '#key' do @@ -73,6 +73,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do :distribution | 'test' :tier | %w(test ee) :name | 'count_<adjective_describing>_boards' + :repair_issue_url | nil :instrumentation_class | 'Metric_Class' :instrumentation_class | 'metricClass' @@ -103,6 +104,19 @@ RSpec.describe Gitlab::Usage::MetricDefinition do end end end + + context 'conditional validations' do + context 'when metric has broken status' do + it 'has to have repair issue url provided' do + attributes[:status] = 'broken' + attributes.delete(:repair_issue_url) + + expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).at_least(:once).with(instance_of(Gitlab::Usage::Metric::InvalidMetricError)) + + described_class.new(path, attributes).validate! + end + end + end end describe 'statuses' do @@ -153,7 +167,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do is_expected.to be_one end - it 'when the same meric is defined multiple times raises exception' do + it 'when the same metric is defined multiple times raises exception' do write_metric(metric1, path, yaml_content) write_metric(metric2, path, yaml_content) |