2011-07-28 14:37:21 -04:00
|
|
|
module Shindo
|
|
|
|
class Tests
|
|
|
|
def given_a_load_balancer_service(&block)
|
2011-08-04 17:21:22 -04:00
|
|
|
@service = Fog::Rackspace::LoadBalancers.new
|
2011-07-28 14:37:21 -04:00
|
|
|
instance_eval(&block)
|
|
|
|
end
|
|
|
|
def given_a_load_balancer(&block)
|
|
|
|
@lb = @service.load_balancers.create({
|
|
|
|
:name => ('fog' + Time.now.to_i.to_s),
|
|
|
|
:protocol => 'HTTP',
|
|
|
|
:port => 80,
|
|
|
|
:virtual_ips => [{ :type => 'PUBLIC'}],
|
2012-05-15 17:38:45 -04:00
|
|
|
:nodes => [{ :address => '1.1.1.1', :port => 80, :condition => 'ENABLED'}]
|
2011-07-28 14:37:21 -04:00
|
|
|
})
|
|
|
|
@lb.wait_for { ready? }
|
|
|
|
begin
|
|
|
|
instance_eval(&block)
|
|
|
|
ensure
|
|
|
|
@lb.wait_for { ready? }
|
|
|
|
@lb.destroy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|