diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/lib/gitlab/etag_caching/middleware_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/etag_caching/middleware_spec.rb')
-rw-r--r-- | spec/lib/gitlab/etag_caching/middleware_spec.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/lib/gitlab/etag_caching/middleware_spec.rb b/spec/lib/gitlab/etag_caching/middleware_spec.rb index 3122a3b1c07..c4da89e5f5c 100644 --- a/spec/lib/gitlab/etag_caching/middleware_spec.rb +++ b/spec/lib/gitlab/etag_caching/middleware_spec.rb @@ -33,7 +33,6 @@ RSpec.describe Gitlab::EtagCaching::Middleware, :clean_gitlab_redis_shared_state expect(headers['ETag']).to be_nil expect(headers['X-Gitlab-From-Cache']).to be_nil - expect(headers[::Gitlab::Metrics::RequestsRackMiddleware::FEATURE_CATEGORY_HEADER]).to be_nil end it 'passes status code from app' do @@ -41,6 +40,12 @@ RSpec.describe Gitlab::EtagCaching::Middleware, :clean_gitlab_redis_shared_state expect(status).to eq app_status_code end + + it 'does not set feature category attribute' do + expect(Gitlab::ApplicationContext).not_to receive(:push) + + _, _, _ = middleware.call(build_request(path, if_none_match)) + end end context 'when there is no ETag in store for given resource' do @@ -164,8 +169,15 @@ RSpec.describe Gitlab::EtagCaching::Middleware, :clean_gitlab_redis_shared_state it 'sets correct headers' do _, headers, _ = middleware.call(build_request(path, if_none_match)) - expect(headers).to include('X-Gitlab-From-Cache' => 'true', - ::Gitlab::Metrics::RequestsRackMiddleware::FEATURE_CATEGORY_HEADER => 'issue_tracking') + expect(headers).to include('X-Gitlab-From-Cache' => 'true') + end + + it "pushes route's feature category to the context" do + expect(Gitlab::ApplicationContext).to receive(:push).with( + feature_category: 'issue_tracking' + ) + + _, _, _ = middleware.call(build_request(path, if_none_match)) end it_behaves_like 'sends a process_action.action_controller notification', 304 |