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:
Yorick Peterse 2016-10-11 17:31:19 +02:00
parent 24261f2dbd
commit 89bb29b247
No known key found for this signature in database
GPG key ID: EDD30D2BEB691AC9

View file

@ -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)