diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/requests/api/graphql/ci/jobs_spec.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/requests/api/graphql/ci/jobs_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/ci/jobs_spec.rb | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/spec/requests/api/graphql/ci/jobs_spec.rb b/spec/requests/api/graphql/ci/jobs_spec.rb index 7d416f4720b..618705e5f94 100644 --- a/spec/requests/api/graphql/ci/jobs_spec.rb +++ b/spec/requests/api/graphql/ci/jobs_spec.rb @@ -34,6 +34,9 @@ RSpec.describe 'Query.project.pipeline.stages.groups.jobs' do jobs { nodes { name + pipeline { + id + } } } } @@ -53,7 +56,7 @@ RSpec.describe 'Query.project.pipeline.stages.groups.jobs' do end context 'when fetching jobs from the pipeline' do - it 'avoids N+1 queries' do + it 'avoids N+1 queries', :aggregate_failures do control_count = ActiveRecord::QueryRecorder.new do post_graphql(query, current_user: user) end @@ -86,8 +89,27 @@ RSpec.describe 'Query.project.pipeline.stages.groups.jobs' do docker_jobs = docker_group.dig('jobs', 'nodes') rspec_jobs = rspec_group.dig('jobs', 'nodes') - expect(docker_jobs).to eq([{ 'name' => 'docker 1 2' }, { 'name' => 'docker 2 2' }]) - expect(rspec_jobs).to eq([{ 'name' => 'rspec 1 2' }, { 'name' => 'rspec 2 2' }]) + expect(docker_jobs).to eq([ + { + 'name' => 'docker 1 2', + 'pipeline' => { 'id' => pipeline.to_global_id.to_s } + }, + { + 'name' => 'docker 2 2', + 'pipeline' => { 'id' => pipeline.to_global_id.to_s } + } + ]) + + expect(rspec_jobs).to eq([ + { + 'name' => 'rspec 1 2', + 'pipeline' => { 'id' => pipeline.to_global_id.to_s } + }, + { + 'name' => 'rspec 2 2', + 'pipeline' => { 'id' => pipeline.to_global_id.to_s } + } + ]) end end end |