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>2023-05-17 19:05:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /spec/benchmarks
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'spec/benchmarks')
-rw-r--r--spec/benchmarks/banzai_benchmark.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/benchmarks/banzai_benchmark.rb b/spec/benchmarks/banzai_benchmark.rb
index 7a60825c1e6..45f45bcc8dd 100644
--- a/spec/benchmarks/banzai_benchmark.rb
+++ b/spec/benchmarks/banzai_benchmark.rb
@@ -16,8 +16,15 @@ require 'benchmark/ips'
# or
# rake benchmark:banzai
#
+# A specific filter can also be benchmarked by using the `FILTER`
+# environment variable.
+#
+# BENCHMARK=1 FILTER=MathFilter rspec spec/benchmarks/banzai_benchmark.rb --tag specific_filter
+# or
+# FILTER=MathFilter rake benchmark:banzai
+#
# rubocop: disable RSpec/TopLevelDescribePath
-RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures do
+RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures, feature_category: :team_planning do
include MarkupHelper
let_it_be(:feature) { MarkdownFeature.new }
@@ -83,9 +90,15 @@ RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures do
benchmark_pipeline_filters(:plain_markdown)
end
- it 'benchmarks specified filters in the FullPipeline' do
- filter_klass_list = [Banzai::Filter::MathFilter]
- benchmark_pipeline_filters(:full, filter_klass_list)
+ it 'benchmarks specified filters in the FullPipeline', :specific_filter do
+ begin
+ filter = ENV['FILTER'] || 'MarkdownFilter'
+ filter_klass = "Banzai::Filter::#{filter}".constantize
+ rescue NameError
+ raise 'Incorrect filter specified. Correct example: FILTER=MathFilter'
+ end
+
+ benchmark_pipeline_filters(:full, [filter_klass])
end
end
@@ -114,7 +127,8 @@ RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures do
pipeline = Banzai::Pipeline[pipeline_type]
filter_source = build_filter_text(pipeline, markdown_text)
- puts "\n--> Benchmarking #{pipeline.name.demodulize} filters\n"
+ filter_msg = filter_klass_list ? filter_klass_list.first.name.demodulize : 'all filters'
+ puts "\n--> Benchmarking #{filter_msg} for #{pipeline.name.demodulize}\n"
Benchmark.ips do |x|
x.config(time: 10, warmup: 2)