2011-08-04 17:21:22 -04:00
|
|
|
Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancer', ['rackspace']) do
|
2011-07-10 16:35:30 -04:00
|
|
|
|
2011-08-16 12:56:44 -04:00
|
|
|
pending if Fog.mocking?
|
|
|
|
|
2011-07-19 18:48:21 -04:00
|
|
|
LOAD_BALANCER_ATTRIBUTES = {
|
|
|
|
:name => 'fog' + Time.now.to_i.to_s,
|
2011-07-10 16:35:30 -04:00
|
|
|
:protocol => 'HTTP',
|
|
|
|
:port => 80,
|
|
|
|
:virtual_ips => [{ :type => 'PUBLIC'}],
|
|
|
|
:nodes => [{ :address => '10.0.0.1', :port => 80, :condition => 'ENABLED'}]
|
2011-07-19 18:48:21 -04:00
|
|
|
}
|
|
|
|
|
2011-07-28 14:37:21 -04:00
|
|
|
given_a_load_balancer_service do
|
|
|
|
model_tests(@service.load_balancers, LOAD_BALANCER_ATTRIBUTES, false) do
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests('#save => saving existing with port = 88').succeeds do
|
|
|
|
@instance.port = 88
|
|
|
|
@instance.save
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests('#enable_connection_logging').succeeds do
|
|
|
|
@instance.enable_connection_logging
|
|
|
|
returns(true) { @instance.connection_logging }
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests('#disable_connection_logging').succeeds do
|
|
|
|
@instance.disable_connection_logging
|
|
|
|
returns(false) { @instance.connection_logging }
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#usage').succeeds do
|
|
|
|
@instance.usage
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#usage(:start_time => '2010-05-10', :end_time => '2010-05-11')").succeeds do
|
|
|
|
@instance.usage(:start_time => '2010-05-10', :end_time => '2010-05-11')
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#health_monitor").returns(nil) do
|
|
|
|
@instance.health_monitor
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#enable_health_monitor('CONNECT', 5, 5, 5)").succeeds do
|
|
|
|
@instance.enable_health_monitor('CONNECT', 5, 5, 5)
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#health_monitor").succeeds do
|
|
|
|
monitor = @instance.health_monitor
|
|
|
|
returns('CONNECT') { monitor['type'] }
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#disable_health_monitor").succeeds do
|
|
|
|
@instance.disable_health_monitor
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#connection_throttling").returns(nil) do
|
|
|
|
@instance.connection_throttling
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#enable_connection_throttling(5, 5, 5, 5)").succeeds do
|
|
|
|
@instance.enable_connection_throttling(5, 5, 5, 5)
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#connection_throttling").succeeds do
|
|
|
|
throttle = @instance.connection_throttling
|
|
|
|
returns(5) { throttle['maxConnections'] }
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#disable_connection_throttling").succeeds do
|
|
|
|
@instance.disable_connection_throttling
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#session_persistence").returns(nil) do
|
|
|
|
@instance.session_persistence
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#enable_session_persistence('HTTP_COOKIE')").succeeds do
|
|
|
|
@instance.enable_session_persistence('HTTP_COOKIE')
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#connction_throttling").succeeds do
|
|
|
|
persistence = @instance.session_persistence
|
|
|
|
returns('HTTP_COOKIE') { persistence['persistenceType'] }
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
tests("#disable_session_persistence").succeeds do
|
|
|
|
@instance.disable_session_persistence
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
@lb = @service.load_balancers.new LOAD_BALANCER_ATTRIBUTES
|
|
|
|
tests('#usage => Requires ID').raises(ArgumentError) do
|
|
|
|
@lb.usage
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#health_monitor => Requires ID').raises(ArgumentError) do
|
|
|
|
@lb.health_monitor
|
|
|
|
end
|
2011-07-28 10:15:51 -04:00
|
|
|
end
|
2011-07-10 16:35:30 -04:00
|
|
|
end
|
|
|
|
end
|