Skip to content

Commit

Permalink
Make passing of mock redis to helper calls more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkirby committed Nov 16, 2016
1 parent 0137a47 commit a52391a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
24 changes: 11 additions & 13 deletions spec/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion spec/vmpooler/pool_manager_migration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
{
Expand Down

0 comments on commit a52391a

Please sign in to comment.