Commit 7f2957c6 authored by Adrien Kohlbecker's avatar Adrien Kohlbecker Committed by Robert Speicher

Drop etag cache on logs API

parent f46fc221
---
title: Drop etag cache on logs API
merge_request: 24864
author:
type: fixed
...@@ -41,15 +41,6 @@ module PodLogs ...@@ -41,15 +41,6 @@ module PodLogs
end end
end end
def reactive_cache_updated(request, _opts)
case request
when CACHE_KEY_GET_POD_LOG
::Gitlab::EtagCaching::Store.new.tap do |store|
store.touch(etag_path)
end
end
end
private private
def valid_params def valid_params
...@@ -130,10 +121,6 @@ module PodLogs ...@@ -130,10 +121,6 @@ module PodLogs
raise NotImplementedError raise NotImplementedError
end end
def etag_path
raise NotImplementedError
end
def filter_return_keys(result) def filter_return_keys(result)
result.slice(*SUCCESS_RETURN_KEYS) result.slice(*SUCCESS_RETURN_KEYS)
end end
......
...@@ -52,15 +52,5 @@ module PodLogs ...@@ -52,15 +52,5 @@ module PodLogs
success(result) success(result)
end end
def etag_path
::Gitlab::Routing.url_helpers.elasticsearch_project_logs_path(
environment.project,
params.merge({
environment_name: environment.name,
format: :json
})
)
end
end end
end end
...@@ -46,15 +46,5 @@ module PodLogs ...@@ -46,15 +46,5 @@ module PodLogs
error_code: e.error_code error_code: e.error_code
}) })
end end
def etag_path
::Gitlab::Routing.url_helpers.k8s_project_logs_path(
environment.project,
params.merge({
environment_name: environment.name,
format: :json
})
)
end
end end
end end
...@@ -8,14 +8,6 @@ module EE ...@@ -8,14 +8,6 @@ module EE
::Gitlab::EtagCaching::Router::Route.new( ::Gitlab::EtagCaching::Router::Route.new(
%r(^/groups/#{::Gitlab::PathRegex.full_namespace_route_regex}/-/epics/\d+/notes\z), %r(^/groups/#{::Gitlab::PathRegex.full_namespace_route_regex}/-/epics/\d+/notes\z),
'epic_notes' 'epic_notes'
),
::Gitlab::EtagCaching::Router::Route.new(
%r(#{::Gitlab::EtagCaching::Router::RESERVED_WORDS_PREFIX}/logs/k8s\.json(\?.*)?\z),
'k8s_pod_logs'
),
::Gitlab::EtagCaching::Router::Route.new(
%r(#{::Gitlab::EtagCaching::Router::RESERVED_WORDS_PREFIX}/logs/elasticsearch\.json(\?.*)?\z),
'elasticsearch_pod_logs'
) )
].freeze ].freeze
......
...@@ -19,41 +19,4 @@ describe Gitlab::EtagCaching::Router do ...@@ -19,41 +19,4 @@ describe Gitlab::EtagCaching::Router do
expect(result).to be_blank expect(result).to be_blank
end end
context 'k8s pod logs' do
it 'matches with pod_name and container_name' do
result = described_class.match(
'/environments/7/pods/pod_name/containers/container_name/logs/k8s.json'
)
expect(result).to be_present
expect(result.name).to eq 'k8s_pod_logs'
end
it 'matches with pod_name' do
result = described_class.match(
'/environments/7/pods/pod_name/containers/logs/k8s.json'
)
expect(result).to be_present
expect(result.name).to eq 'k8s_pod_logs'
end
it 'matches without pod_name and container_name' do
result = described_class.match(
'/environments/7/pods/containers/logs/k8s.json'
)
expect(result).to be_present
expect(result.name).to eq 'k8s_pod_logs'
end
it 'does not match non json format' do
result = described_class.match(
'/environments/7/logs'
)
expect(result).not_to be_present
end
end
end end
...@@ -201,21 +201,4 @@ describe ::PodLogs::BaseService do ...@@ -201,21 +201,4 @@ describe ::PodLogs::BaseService do
expect(result[:message]).to eq('Container does not exist') expect(result[:message]).to eq('Container does not exist')
end end
end end
describe '#reactive_cache_updated' do
context 'get_pod_log' do
let(:cache_key) { 'get_pod_log' }
it 'expires k8s_pod_logs etag cache' do
expected_path = "/root/autodevops-deploy/-/logs/k8s.json"
allow(subject).to receive(:etag_path).and_return(expected_path)
allow_next_instance_of(Gitlab::EtagCaching::Store) do |store|
allow(store).to receive(:touch).with(expected_path).and_call_original
end
subject.reactive_cache_updated(cache_key, {})
end
end
end
end end
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