diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 00:09:12 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 00:09:12 +0000 |
commit | d43aaf286fe6b8e8383e73ea580274d8841608d7 (patch) | |
tree | ca03542a55583538a1ec13023dffed20457407b5 /spec/lib/gitlab/sidekiq_middleware_spec.rb | |
parent | 87af6f2e0590af0ed1bb3e5de1bb5d21855a94d2 (diff) | |
download | gitlab-ce-d43aaf286fe6b8e8383e73ea580274d8841608d7.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/sidekiq_middleware_spec.rb')
-rw-r--r-- | spec/lib/gitlab/sidekiq_middleware_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/sidekiq_middleware_spec.rb b/spec/lib/gitlab/sidekiq_middleware_spec.rb index 2f325fd5052..88f83ebc2ac 100644 --- a/spec/lib/gitlab/sidekiq_middleware_spec.rb +++ b/spec/lib/gitlab/sidekiq_middleware_spec.rb @@ -8,6 +8,8 @@ describe Gitlab::SidekiqMiddleware do include Sidekiq::Worker def perform(_arg) + Gitlab::SafeRequestStore['gitaly_call_actual'] = 1 + Gitlab::GitalyClient.query_time = 5 end end @@ -99,6 +101,24 @@ describe Gitlab::SidekiqMiddleware do it "passes through server middlewares" do worker_class.perform_async(*job_args) end + + context "server metrics" do + let(:gitaly_histogram) { double(:gitaly_histogram) } + + before do + allow(Gitlab::Metrics).to receive(:histogram).and_call_original + + allow(Gitlab::Metrics).to receive(:histogram) + .with(:sidekiq_jobs_gitaly_seconds, anything, anything, anything) + .and_return(gitaly_histogram) + end + + it "records correct Gitaly duration" do + expect(gitaly_histogram).to receive(:observe).with(anything, 5.0) + + worker_class.perform_async(*job_args) + end + end end end |