Commit 5fa60a22 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'fix-canary-update-service-to-invalidate-cache' into 'master'

Fix Canary Ingress weight is not reflected on UI immediately

See merge request gitlab-org/gitlab!50246
parents bce8f6a8 c5b98228
...@@ -405,6 +405,11 @@ class Environment < ApplicationRecord ...@@ -405,6 +405,11 @@ class Environment < ApplicationRecord
deployment_platform.patch_ingress(deployment_namespace, ingress, data) deployment_platform.patch_ingress(deployment_namespace, ingress, data)
end end
def clear_all_caches
expire_etag_cache
clear_reactive_cache!
end
private private
def rollout_status_available? def rollout_status_available?
......
...@@ -24,6 +24,7 @@ module Environments ...@@ -24,6 +24,7 @@ module Environments
end end
if environment.patch_ingress(canary_ingress, patch_data) if environment.patch_ingress(canary_ingress, patch_data)
environment.clear_all_caches
success success
else else
error(_('Failed to update the Canary Ingress.'), :bad_request) error(_('Failed to update the Canary Ingress.'), :bad_request)
......
---
title: Fix Canary Ingress weight is not reflected on UI immediately
merge_request: 50246
author:
type: fixed
...@@ -1547,4 +1547,18 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do ...@@ -1547,4 +1547,18 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
end end
end end
end end
describe '#clear_all_caches' do
subject { environment.clear_all_caches }
it 'clears all caches on the environment' do
expect_next_instance_of(Gitlab::EtagCaching::Store) do |store|
expect(store).to receive(:touch).with(environment.etag_cache_key)
end
expect(environment).to receive(:clear_reactive_cache!)
subject
end
end
end end
...@@ -117,6 +117,12 @@ RSpec.describe Environments::CanaryIngress::UpdateService, :clean_gitlab_redis_c ...@@ -117,6 +117,12 @@ RSpec.describe Environments::CanaryIngress::UpdateService, :clean_gitlab_redis_c
expect(subject[:status]).to eq(:success) expect(subject[:status]).to eq(:success)
expect(subject[:message]).to be_nil expect(subject[:message]).to be_nil
end end
it 'clears all caches' do
expect(environment).to receive(:clear_all_caches)
subject
end
end end
context 'when patch request does not succeed' do context 'when patch request does not succeed' 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