2011-08-04 17:21:22 -04:00
|
|
|
Shindo.tests('Fog::Rackspace::LoadBalancers | session_persistence', ['rackspace']) do
|
2011-07-27 17:06:24 -04:00
|
|
|
|
2011-08-16 12:56:44 -04:00
|
|
|
pending if Fog.mocking?
|
|
|
|
|
2011-07-28 14:37:21 -04:00
|
|
|
given_a_load_balancer_service do
|
|
|
|
given_a_load_balancer do
|
|
|
|
tests('success') do
|
|
|
|
@lb.wait_for { ready? }
|
|
|
|
tests("#set_session_persistence(#{@lb.id}, 'HTTP_COOKIE')").succeeds do
|
|
|
|
@service.set_session_persistence(@lb.id, 'HTTP_COOKIE')
|
|
|
|
end
|
2011-07-27 17:06:24 -04:00
|
|
|
|
2011-07-28 14:37:21 -04:00
|
|
|
@lb.wait_for { ready? }
|
|
|
|
tests("#get_session_persistence{@lb.id})").formats(SESSION_PERSISTENCE_FORMAT) do
|
|
|
|
data = @service.get_session_persistence(@lb.id).body
|
|
|
|
returns('HTTP_COOKIE') { data['sessionPersistence']['persistenceType'] }
|
|
|
|
data
|
|
|
|
end
|
2011-07-27 17:06:24 -04:00
|
|
|
|
2011-07-28 14:37:21 -04:00
|
|
|
@lb.wait_for { ready? }
|
|
|
|
tests("#remove_session_persistence()").succeeds do
|
|
|
|
@service.remove_session_persistence(@lb.id)
|
|
|
|
end
|
|
|
|
end
|
2011-07-27 17:06:24 -04:00
|
|
|
|
2011-07-28 14:37:21 -04:00
|
|
|
tests('failure') do
|
2011-08-16 22:22:24 -04:00
|
|
|
tests("#set_session_persistence(#{@lb.id}, 'aaa')").raises(Fog::Rackspace::LoadBalancers::BadRequest) do
|
2011-07-28 14:37:21 -04:00
|
|
|
@service.set_session_persistence(@lb.id, 'aaa')
|
|
|
|
end
|
|
|
|
end
|
2011-07-27 17:06:24 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|