summaryrefslogtreecommitdiff
path: root/spec/requests/api/issues/get_project_issues_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-08-23 16:38:01 -0700
committerStan Hu <stanhu@gmail.com>2019-08-23 21:26:50 -0700
commit440635015fbea129cbfd7b266589ea2a33dda471 (patch)
tree13c2379f7d9bb2647f6cd5ba06948f5ad2a3b6c7 /spec/requests/api/issues/get_project_issues_spec.rb
parent20d38feda1b7085a2d1246a960ab575cd545da8f (diff)
downloadgitlab-ce-440635015fbea129cbfd7b266589ea2a33dda471.tar.gz
Fix N+1 Gitaly calls in /api/v4/projects/:id/issuessh-fix-nplusone-issues
This is a follow-up from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31938. In GitLab 9.0, https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9661 removed the `subscribed` flag from the API when the user requested a list of issues or merge requests since calculating this value triggers extensive Markdown processing. In GitLab 12.0 via a4fbf39e, we accidentally reintroduced this performance regression by changing `IssueBasic` to `Issue` in `entities.rb`. This showed up as a Gitaly N+1 issue since the Markdown processing would attempt to extract a commit if it detected a regex that matched a commit. We restore the prior behavior by once again removing the `subscribed` flag for the bulk list of issues and merge requests and add a test to ensure they aren't reintroduced. Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/66202
Diffstat (limited to 'spec/requests/api/issues/get_project_issues_spec.rb')
-rw-r--r--spec/requests/api/issues/get_project_issues_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/requests/api/issues/get_project_issues_spec.rb b/spec/requests/api/issues/get_project_issues_spec.rb
index 521d6b88734..b7aa3f93451 100644
--- a/spec/requests/api/issues/get_project_issues_spec.rb
+++ b/spec/requests/api/issues/get_project_issues_spec.rb
@@ -446,6 +446,14 @@ describe API::Issues do
expect_paginated_array_response([closed_issue.id, confidential_issue.id, issue.id])
end
+ it 'exposes known attributes' do
+ get api("#{base_url}/issues", user)
+
+ 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
+
context 'issues_statistics' do
context 'no state is treated as all state' do
let(:params) { {} }