Auto-expire summary index keys

This commit is contained in:
Scott Schneider 2015-05-13 11:18:19 -07:00
parent 6d06128481
commit 2e5fdc5200
4 changed files with 20 additions and 1 deletions

View file

@ -302,7 +302,10 @@ describe Vmpooler::API::V1 do
pools: [
{'name' => 'pool1', 'size' => 5},
{'name' => 'pool2', 'size' => 10}
]
],
redis: {
'data_ttl' => '168'
}
} }
before do
@ -310,6 +313,7 @@ describe Vmpooler::API::V1 do
app.settings.set :redis, redis
allow(redis).to receive(:exists).and_return '1'
allow(redis).to receive(:expire).with('vmpooler__tag__' + Date.today.to_s, 604800).and_return '1'
allow(redis).to receive(:hset).and_return '1'
end

View file

@ -81,11 +81,17 @@ describe 'Pool Manager' do
end
context 'a host with proper summary' do
let(:config) { {
redis: { 'data_ttl' => '168' }
} }
before do
allow(host).to receive(:summary).and_return true
allow(host).to receive_message_chain(:summary, :guest).and_return true
allow(host).to receive_message_chain(:summary, :guest, :hostName).and_return vm
allow(redis).to receive(:expire).with('vmpooler__boot__' + Date.today.to_s, 604800).and_return '1'
allow(redis).to receive(:hget)
allow(redis).to receive(:smove)
allow(redis).to receive(:hset)