Commit 1e0bd1ac authored by Rémy Coutable's avatar Rémy Coutable

Fix a flaky example in pipelines_controller_spec

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent d1613be7
...@@ -29,7 +29,7 @@ describe Projects::PipelinesController do ...@@ -29,7 +29,7 @@ describe Projects::PipelinesController do
stub_feature_flags(ci_pipeline_persisted_stages: true) stub_feature_flags(ci_pipeline_persisted_stages: true)
end end
it 'returns serialized pipelines', :request_store do it 'returns serialized pipelines' do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
get_pipelines_index_json get_pipelines_index_json
...@@ -60,7 +60,6 @@ describe Projects::PipelinesController do ...@@ -60,7 +60,6 @@ describe Projects::PipelinesController do
# There appears to be one extra query for Pipelines#has_warnings? for some reason # There appears to be one extra query for Pipelines#has_warnings? for some reason
expect { get_pipelines_index_json }.not_to exceed_query_limit(control_count + 1) expect { get_pipelines_index_json }.not_to exceed_query_limit(control_count + 1)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['pipelines'].count).to eq 10 expect(json_response['pipelines'].count).to eq 10
end end
...@@ -90,11 +89,18 @@ describe Projects::PipelinesController do ...@@ -90,11 +89,18 @@ describe Projects::PipelinesController do
end end
it 'does not execute N+1 queries' do it 'does not execute N+1 queries' do
queries = ActiveRecord::QueryRecorder.new do get_pipelines_index_json
control_count = ActiveRecord::QueryRecorder.new do
get_pipelines_index_json get_pipelines_index_json
end end.count
expect(queries.count).to be <= 36 create_all_pipeline_types
# There appears to be one extra query for Pipelines#has_warnings? for some reason
expect { get_pipelines_index_json }.not_to exceed_query_limit(control_count + 1)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['pipelines'].count).to eq 10
end end
end 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