diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/lib/gitlab/usage_data_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/lib/gitlab/usage_data_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage_data_spec.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index 214331e15e8..592ac280d32 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::UsageData, :aggregate_failures do +RSpec.describe Gitlab::UsageData, :aggregate_failures, feature_category: :service_ping do include UsageDataHelpers before do @@ -1122,12 +1122,20 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do end end - describe ".with_duration" do + describe ".with_metadata" do it 'records duration' do - expect(::Gitlab::Usage::ServicePing::LegacyMetricTimingDecorator) - .to receive(:new).with(2, kind_of(Float)) + result = described_class.with_metadata { 1 + 1 } - described_class.with_duration { 1 + 1 } + expect(result.duration).to be_an(Float) + end + + it 'records error and returns nil', :aggregated_errors do + allow(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception) + + result = described_class.with_metadata { raise } + + expect(result.error).to be_an(StandardError) + expect(result).to be_nil end end |