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>2020-02-28 18:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-28 18:09:13 +0300
commit736d36d8597d0d1ec1b47644e6d091c3f4a78f45 (patch)
treea38f6fef2b7147416b31f8294a9389b3bb472c87 /spec/lib/gitlab/profiler_spec.rb
parent5426ca9908085087d465fa52800335f408eb965a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/profiler_spec.rb')
-rw-r--r--spec/lib/gitlab/profiler_spec.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/spec/lib/gitlab/profiler_spec.rb b/spec/lib/gitlab/profiler_spec.rb
index 603417c5532..6440f74a49a 100644
--- a/spec/lib/gitlab/profiler_spec.rb
+++ b/spec/lib/gitlab/profiler_spec.rb
@@ -195,6 +195,7 @@ describe Gitlab::Profiler do
describe '.print_by_total_time' do
let(:stdout) { StringIO.new }
+ let(:regexp) { /^\s+\d+\.\d+\s+(\d+\.\d+)/ }
let(:output) do
stdout.rewind
@@ -202,6 +203,8 @@ describe Gitlab::Profiler do
end
let_it_be(:result) do
+ Thread.new { sleep 1 }
+
RubyProf.profile do
sleep 0.1
1.to_s
@@ -212,23 +215,22 @@ describe Gitlab::Profiler do
stub_const('STDOUT', stdout)
end
- it 'prints a profile result sorted by total time', quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/206907' do
+ it 'prints a profile result sorted by total time' do
described_class.print_by_total_time(result)
- total_times =
- output
- .scan(/^\s+\d+\.\d+\s+(\d+\.\d+)/)
- .map { |(total)| total.to_f }
-
expect(output).to include('Kernel#sleep')
- if total_times != total_times.sort.reverse
- warn "Profiler test failed, output is:"
- warn output
- end
+ thread_profiles = output.split('Sort by: total_time').select { |x| x =~ regexp }
- expect(total_times).to eq(total_times.sort.reverse)
- expect(total_times).not_to eq(total_times.uniq)
+ thread_profiles.each do |profile|
+ total_times =
+ profile
+ .scan(regexp)
+ .map { |(total)| total.to_f }
+
+ expect(total_times).to eq(total_times.sort.reverse)
+ expect(total_times).not_to eq(total_times.uniq)
+ end
end
it 'accepts a max_percent option' do