diff options
author | Sean McGivern <sean@gitlab.com> | 2019-08-20 15:58:03 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-08-20 15:58:03 +0300 |
commit | 57ec78d53066cf9184859a0202609eb01567eab9 (patch) | |
tree | 0fec8bd0238520e11cb226f118ab6590e29f44fb /spec | |
parent | 9e6a8bb93b6fbcbe5657079108332b99fc8749cc (diff) | |
parent | ba7c501fef5976ea7a1cc4212e84742246fed781 (diff) |
Merge branch 'sh-fix-issues-api-gitaly-nplusone' into 'master'
Fix Gitaly N+1 calls with listing issues/MRs via API
Closes #66202
See merge request gitlab-org/gitlab-ce!31938
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/issues/get_group_issues_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/issues/get_project_issues_spec.rb | 1 | ||||
-rw-r--r-- | spec/requests/api/issues/issues_spec.rb | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/spec/requests/api/issues/get_group_issues_spec.rb b/spec/requests/api/issues/get_group_issues_spec.rb index 5916bb11516..c487471e4a1 100644 --- a/spec/requests/api/issues/get_group_issues_spec.rb +++ b/spec/requests/api/issues/get_group_issues_spec.rb @@ -342,6 +342,14 @@ describe API::Issues do group_project.add_reporter(user) end + it 'exposes known attributes' do + get api(base_url, admin) + + expect(response).to have_gitlab_http_status(200) + expect(json_response.last.keys).to include(*%w(id iid project_id title description)) + expect(json_response.last).not_to have_key('subscribed') + end + it 'returns all group issues (including opened and closed)' do get api(base_url, admin) diff --git a/spec/requests/api/issues/get_project_issues_spec.rb b/spec/requests/api/issues/get_project_issues_spec.rb index f7ca6fd1e0a..521d6b88734 100644 --- a/spec/requests/api/issues/get_project_issues_spec.rb +++ b/spec/requests/api/issues/get_project_issues_spec.rb @@ -575,6 +575,7 @@ describe API::Issues do expect(json_response['assignee']).to be_a Hash expect(json_response['author']).to be_a Hash expect(json_response['confidential']).to be_falsy + expect(json_response['subscribed']).to be_truthy end it 'exposes the closed_at attribute' do diff --git a/spec/requests/api/issues/issues_spec.rb b/spec/requests/api/issues/issues_spec.rb index d195f54be11..27cf66629fe 100644 --- a/spec/requests/api/issues/issues_spec.rb +++ b/spec/requests/api/issues/issues_spec.rb @@ -216,6 +216,10 @@ describe API::Issues do expect_paginated_array_response([issue.id, closed_issue.id]) expect(json_response.first['title']).to eq(issue.title) expect(json_response.last).to have_key('web_url') + # Calculating the value of subscribed field triggers Markdown + # processing. We can't do that for multiple issues / merge + # requests in a single API request. + expect(json_response.last).not_to have_key('subscribed') end it 'returns an array of closed issues' do |