Flush Housekeeping data from Redis specs
These specs use raw Redis objects which can not use the memory based caching mechanism used for tests. As such we have to explicitly flush the data from Redis before/after each spec to ensure no data lingers on.
This commit is contained in:
parent
24261f2dbd
commit
89bb29b247
1 changed files with 7 additions and 0 deletions
|
@ -538,9 +538,16 @@ describe GitPushService, services: true do
|
||||||
let(:housekeeping) { Projects::HousekeepingService.new(project) }
|
let(:housekeeping) { Projects::HousekeepingService.new(project) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
# Flush any raw Redis data stored by the housekeeping code.
|
||||||
|
Gitlab::Redis.with { |conn| conn.flushall }
|
||||||
|
|
||||||
allow(Projects::HousekeepingService).to receive(:new).and_return(housekeeping)
|
allow(Projects::HousekeepingService).to receive(:new).and_return(housekeeping)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Gitlab::Redis.with { |conn| conn.flushall }
|
||||||
|
end
|
||||||
|
|
||||||
it 'does not perform housekeeping when not needed' do
|
it 'does not perform housekeeping when not needed' do
|
||||||
expect(housekeeping).not_to receive(:execute)
|
expect(housekeeping).not_to receive(:execute)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue