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.
This commit is contained in:
parent
00b00f1ede
commit
696b039511
1 changed files with 8 additions and 3 deletions
|
@ -17,10 +17,15 @@ describe Deployment, models: true do
|
||||||
it { is_expected.to validate_presence_of(:sha) }
|
it { is_expected.to validate_presence_of(:sha) }
|
||||||
|
|
||||||
describe 'after_create callbacks' do
|
describe 'after_create callbacks' do
|
||||||
it 'invalidates the cache for the environment' do
|
let(:environment) { create(:environment) }
|
||||||
expect(subject).to receive(:invalidate_cache)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue