summaryrefslogtreecommitdiff
path: root/spec/requests/request_profiler_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
commit36a59d088eca61b834191dacea009677a96c052f (patch)
treee4f33972dab5d8ef79e3944a9f403035fceea43f /spec/requests/request_profiler_spec.rb
parenta1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff)
downloadgitlab-ce-36a59d088eca61b834191dacea009677a96c052f.tar.gz
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/requests/request_profiler_spec.rb')
-rw-r--r--spec/requests/request_profiler_spec.rb56
1 files changed, 0 insertions, 56 deletions
diff --git a/spec/requests/request_profiler_spec.rb b/spec/requests/request_profiler_spec.rb
deleted file mode 100644
index 72689595480..00000000000
--- a/spec/requests/request_profiler_spec.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'Request Profiler' do
- let(:user) { create(:user) }
-
- shared_examples 'profiling a request' do |profile_type, extension|
- before do
- allow(Rails).to receive(:cache).and_return(ActiveSupport::Cache::MemoryStore.new)
- allow(RubyProf::Profile).to receive(:profile) do |&blk|
- blk.call
- RubyProf::Profile.new
- end
- allow(MemoryProfiler).to receive(:report) do |&blk|
- blk.call
- MemoryProfiler.start
- MemoryProfiler.stop
- end
- end
-
- it 'creates a profile of the request' do
- project = create(:project, namespace: user.namespace)
- time = Time.now
- path = "/#{project.full_path}"
-
- travel_to(time) do
- get path, params: {}, headers: { 'X-Profile-Token' => Gitlab::RequestProfiler.profile_token, 'X-Profile-Mode' => profile_type }
- end
-
- profile_type = 'execution' if profile_type.nil?
- profile_path = "#{Gitlab.config.shared.path}/tmp/requests_profiles/#{path.tr('/', '|')}_#{time.to_i}_#{profile_type}.#{extension}"
- expect(File.exist?(profile_path)).to be true
- end
-
- after do
- Gitlab::RequestProfiler.remove_all_profiles
- end
- end
-
- context "when user is logged-in" do
- before do
- login_as(user)
- end
-
- include_examples 'profiling a request', 'execution', 'html'
- include_examples 'profiling a request', nil, 'html'
- include_examples 'profiling a request', 'memory', 'txt'
- end
-
- context "when user is not logged-in" do
- include_examples 'profiling a request', 'execution', 'html'
- include_examples 'profiling a request', nil, 'html'
- include_examples 'profiling a request', 'memory', 'txt'
- end
-end