1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[rackspace|lb] fixed broken test; cleaned up some tests

This commit is contained in:
Brian Hartsock 2011-12-16 13:50:11 -05:00
parent 93df5bfb2f
commit c20b493885

View file

@ -9,7 +9,7 @@ Shindo.tests('Fog::Rackspace::LoadBalancers | node_tests', ['rackspace']) do
tests('success') do
@lb.wait_for { ready? }
tests('#create_node').formats(NODES_FORMAT) do
tests("#create_node(#{@lb.id}, '10.10.10.10', 80, 'ENABLED')").formats(NODES_FORMAT) do
data = @service.create_node(@lb.id, '10.10.10.10', 80, 'ENABLED').body
@nodes_created << data['nodes'][0]['id']
data
@ -23,51 +23,48 @@ Shindo.tests('Fog::Rackspace::LoadBalancers | node_tests', ['rackspace']) do
end
@lb.wait_for { ready? }
tests("list_nodes").formats(NODES_FORMAT) do
tests("#list_nodes(#{@lb.id})").formats(NODES_FORMAT) do
@service.list_nodes(@lb.id).body
end
@lb.wait_for { ready? }
tests("get_node(#{@lb_node_id})").formats(NODE_FORMAT) do
tests("#get_node(#{@lb.id})").formats(NODE_FORMAT) do
@service.get_node(@lb.id, @nodes_created[0]).body
end
tests("update_node(#{@lb.id}, #{@nodes_created[0]})").succeeds do
@lb.wait_for { ready? }
tests("#update_node(#{@lb.id}, #{@nodes_created[0]}, { :condition => 'DISABLED' })").succeeds do
@service.update_node(@lb.id, @nodes_created[0], { :condition => 'DISABLED' })
end
@lb.wait_for { ready? }
tests("condition").succeeds do
@service.update_node(@lb.id, @nodes_created[0], { :condition => 'DISABLED' })
end
@lb.wait_for { ready? }
tests("#update_node(#{@lb.id}, #{@nodes_created[0]}, { :weight => 20})").succeeds do
@service.update_node(@lb.id, @nodes_created[0], { :weight => 20 })
end
@lb.wait_for { ready? }
tests("weight").succeeds do
@service.update_node(@lb.id, @nodes_created[0], { :weight => 20 })
end
@lb.wait_for { ready? }
tests("condition and weight").succeeds do
@service.update_node(@lb.id, @nodes_created[0], { :condition => 'DISABLED', :weight => 20 })
end
@lb.wait_for { ready? }
tests("#update_node(#{@lb.id}, #{@nodes_created[0]}, { :condition => 'DISABLED', :weight => 20 })").succeeds do
@service.update_node(@lb.id, @nodes_created[0], { :condition => 'DISABLED', :weight => 20 })
end
end
tests('failure') do
tests('create_node(invalid ip)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do
tests('#create_node(invalid ip)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do
@service.create_node(@lb.id, '', 80, 'ENABLED')
end
tests('create_node(invalid condition)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do
tests('#create_node(invalid condition)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do
@service.create_node(@lb.id, '10.10.10.10', 80, 'EABLED')
end
tests('get_node(0)').raises(Fog::Rackspace::LoadBalancers::NotFound) do
tests("#get_node(#{@lb.id}, 0)").raises(Fog::Rackspace::LoadBalancers::NotFound) do
@service.get_node(@lb.id, 0)
end
tests('delete_node(0)').raises(Fog::Rackspace::LoadBalancers::NotFound) do
tests("#delete_node(#{@lb.id}, 0)").raises(Fog::Rackspace::LoadBalancers::NotFound) do
@service.delete_node(@lb.id, 0)
end
tests('delete_nodes(0)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do
@service.delete_nodes(@lb.id, 0)
tests("#delete_nodes('a', 'b')").raises(Fog::Rackspace::LoadBalancers::NotFound) do
@service.delete_nodes(@lb.id, 'a', 'b')
end
tests('update_node(0)').raises(Fog::Rackspace::LoadBalancers::NotFound) do
tests("#update_node(#{@lb.id}, 0, { :weight => 20 })").raises(Fog::Rackspace::LoadBalancers::NotFound) do
@service.update_node(@lb.id, 0, { :weight => 20 })
end
end