Commit 543a65e3 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Merge branch 'bw-fix-markdown-benchmark' into 'master'

Correctly pass results in markdown benchmark

See merge request gitlab-org/gitlab!61039
parents dc735579 5a47cfd7
......@@ -88,12 +88,18 @@ RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures do
def build_filter_text(pipeline, initial_text)
filter_source = {}
input_text = initial_text
result = nil
pipeline.filters.each do |filter_klass|
filter_source[filter_klass] = input_text
# store inputs for current filter_klass
filter_source[filter_klass] = { input_text: input_text, input_result: result }
output = filter_klass.call(input_text, context)
filter = filter_klass.new(input_text, context, result)
output = filter.call
# save these for the next filter_klass
input_text = output
result = filter.result
end
filter_source
......@@ -111,7 +117,12 @@ RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures do
pipeline.filters.each do |filter_klass|
label = filter_klass.name.demodulize.delete_suffix('Filter').truncate(20)
x.report(label) { filter_klass.call(filter_source[filter_klass], context) }
x.report(label) do
filter = filter_klass.new(filter_source[filter_klass][:input_text],
context,
filter_source[filter_klass][:input_result])
filter.call
end
end
x.compare!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment