Commit 8df8a56b authored by Gabriel Mazetto's avatar Gabriel Mazetto

Merge branch 'fix-sql-n1-test-for-pipeline-seed' into 'master'

Fix N+1 test of pipeline seed

See merge request gitlab-org/gitlab!60958
parents 606b315b a3580e1e
......@@ -218,15 +218,18 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
end
context 'N+1 queries' do
it 'avoids N+1 queries when calculating variables of jobs' do
it 'avoids N+1 queries when calculating variables of jobs', :use_sql_query_cache do
warm_up_pipeline, warm_up_command = prepare_pipeline1
perform_seed(warm_up_pipeline, warm_up_command)
pipeline1, command1 = prepare_pipeline1
pipeline2, command2 = prepare_pipeline2
control = ActiveRecord::QueryRecorder.new do
control = ActiveRecord::QueryRecorder.new(skip_cached: false) do
perform_seed(pipeline1, command1)
end
expect { perform_seed(pipeline2, command2) }.not_to exceed_query_limit(
expect { perform_seed(pipeline2, command2) }.not_to exceed_all_query_limit(
control.count + expected_extra_queries
)
end
......
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