diff --git a/spec/helpers.rb b/spec/helpers.rb index 2e436663c..9005ec57e 100644 --- a/spec/helpers.rb +++ b/spec/helpers.rb @@ -50,23 +50,21 @@ def create_pending_vm(template, name, token = nil) redis.hset("vmpooler__vm__#{name}", "template", template) end -def create_vm(name, token = nil, r = nil) - redis = r if r - redis.hset("vmpooler__vm__#{name}", 'checkout', Time.now) - if token - redis.hset("vmpooler__vm__#{name}", 'token:token', token) - end +def create_vm(name, token = nil, redis_handle = nil) + redis_db = redis_handle ? redis_handle : redis + redis_db.hset("vmpooler__vm__#{name}", 'checkout', Time.now) + redis_db.hset("vmpooler__vm__#{name}", 'token:token', token) if token end -def create_migrating_vm(name, pool, r = nil) - redis = r if r - redis.hset("vmpooler__vm__#{name}", 'checkout', Time.now) - redis.sadd("vmpooler__migrating__#{pool}", name) +def create_migrating_vm(name, pool, redis_handle = nil) + redis_db = redis_handle ? redis_handle : redis + redis_db.hset("vmpooler__vm__#{name}", 'checkout', Time.now) + redis_db.sadd("vmpooler__migrating__#{pool}", name) end -def add_vm_to_migration_set(name, r=nil) - redis = r if r - redis.sadd('vmpooler__migration', name) +def add_vm_to_migration_set(name, redis_handle = nil) + redis_db = redis_handle ? redis_handle : redis + redis_db.sadd('vmpooler__migration', name) end def fetch_vm(vm) diff --git a/spec/vmpooler/pool_manager_migration_spec.rb b/spec/vmpooler/pool_manager_migration_spec.rb index 88357db65..c586deda2 100644 --- a/spec/vmpooler/pool_manager_migration_spec.rb +++ b/spec/vmpooler/pool_manager_migration_spec.rb @@ -5,7 +5,6 @@ describe 'Pool Manager' do let(:logger) { double('logger') } let(:redis) { MockRedis.new } - #let(:redis) { Redis.new } let(:metrics) { Vmpooler::DummyStatsd.new } let(:config) { {