Commit 696b0395 authored by Z.J. van de Weg's avatar Z.J. van de Weg

Explicitly test etag cache invalidation

When a new deployment is created, this will trigger the invalidation on
the etag cache on the environment. This flow is now explicitly tested.
parent 00b00f1e
......@@ -17,10 +17,15 @@ describe Deployment, models: true do
it { is_expected.to validate_presence_of(:sha) }
describe 'after_create callbacks' do
it 'invalidates the cache for the environment' do
expect(subject).to receive(:invalidate_cache)
let(:environment) { create(:environment) }
let(:store) { Gitlab::EtagCaching::Store.new }
subject.save!
it 'invalidates the environment etag cache' do
old_value = store.get(environment.etag_cache_key)
create(:deployment, environment: environment)
expect(store.get(environment.etag_cache_key)).not_to eq(old_value)
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