Commit 63676cf6 authored by James Fargher's avatar James Fargher

Merge branch '343309-remove-issue-http-cache-feature-flag' into 'master'

Remove the issue_discussions_http_cache flag

See merge request gitlab-org/gitlab!74272
parents 008f3201 4c550234
...@@ -160,7 +160,7 @@ module IssuableActions ...@@ -160,7 +160,7 @@ module IssuableActions
if issuable.is_a?(MergeRequest) if issuable.is_a?(MergeRequest)
render_cached(discussions, with: discussion_serializer, cache_context: -> (_) { discussion_cache_context }, context: self) render_cached(discussions, with: discussion_serializer, cache_context: -> (_) { discussion_cache_context }, context: self)
elsif issuable.is_a?(Issue) && Feature.enabled?(:issue_discussions_http_cache, default_enabled: :yaml) elsif issuable.is_a?(Issue)
render json: discussion_serializer.represent(discussions, context: self) if stale?(etag: [discussion_cache_context, discussions]) render json: discussion_serializer.represent(discussions, context: self) if stale?(etag: [discussion_cache_context, discussions])
else else
render json: discussion_serializer.represent(discussions, context: self) render json: discussion_serializer.represent(discussions, context: self)
......
---
name: issue_discussions_http_cache
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72589
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/343309
milestone: '14.5'
type: development
group: group::project management
default_enabled: false
...@@ -14,6 +14,7 @@ RSpec.describe 'issue discussions' do ...@@ -14,6 +14,7 @@ RSpec.describe 'issue discussions' do
project.add_maintainer(user) project.add_maintainer(user)
end end
context 'HTTP caching' do
def get_discussions def get_discussions
get discussions_namespace_project_issue_path(namespace_id: project.namespace, project_id: project, id: issue.iid), headers: { get discussions_namespace_project_issue_path(namespace_id: project.namespace, project_id: project, id: issue.iid), headers: {
'If-None-Match' => @etag 'If-None-Match' => @etag
...@@ -28,17 +29,6 @@ RSpec.describe 'issue discussions' do ...@@ -28,17 +29,6 @@ RSpec.describe 'issue discussions' do
get_discussions get_discussions
end end
shared_examples 'cache miss' do
it 'returns 200 and serializes JSON' do
expect(DiscussionSerializer).to receive(:new).and_call_original
get_discussions
expect(response).to have_gitlab_http_status(:ok)
end
end
shared_examples 'cache hit' do
it 'returns 304 without serializing JSON' do it 'returns 304 without serializing JSON' do
expect(DiscussionSerializer).not_to receive(:new) expect(DiscussionSerializer).not_to receive(:new)
...@@ -46,22 +36,16 @@ RSpec.describe 'issue discussions' do ...@@ -46,22 +36,16 @@ RSpec.describe 'issue discussions' do
expect(response).to have_gitlab_http_status(:not_modified) expect(response).to have_gitlab_http_status(:not_modified)
end end
end
context 'when issue_discussions_http_cache is disabled' do shared_examples 'cache miss' do
before do it 'returns 200 and serializes JSON' do
stub_feature_flags(issue_discussions_http_cache: false) expect(DiscussionSerializer).to receive(:new).and_call_original
end
it_behaves_like 'cache miss' get_discussions
end
context 'when issue_discussions_http_cache is enabled' do expect(response).to have_gitlab_http_status(:ok)
before do end
stub_feature_flags(issue_discussions_http_cache: true)
end end
it_behaves_like 'cache hit'
context 'when user role changes' do context 'when user role changes' do
before do before do
......
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