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

[rackspace|load balancers] fixed broken tests

This commit is contained in:
Brian Hartsock 2011-11-24 12:32:53 -05:00
parent de94fa70f8
commit bf4b1f70ab
3 changed files with 28 additions and 14 deletions

View file

@ -3,6 +3,11 @@ NODE_FORMAT = {'node' => SINGLE_NODE_FORMAT}
NODES_FORMAT = {'nodes' => [SINGLE_NODE_FORMAT]}
VIRTUAL_IP_FORMAT = {'type' => String, 'id' => Integer, 'type' => String, 'ipVersion' => String, 'address' => String}
VIRTUAL_IPS_FORMAT = { 'virtualIps' => [VIRTUAL_IP_FORMAT] }
SOURCE_ADDRESSES = {
'ipv4Servicenet' => String,
'ipv4Public' => String,
'ipv6Public' => String,
}
LOAD_BALANCER_USAGE_FORMAT = {
'loadBalancerUsageRecords' => [
{
@ -87,11 +92,22 @@ LOAD_BALANCERS_FORMAT = {
'port' => Integer,
'protocol' => String,
'algorithm' => String,
'sourceAddresses' => {
'ipv4Servicenet' => String,
'ipv4Public' => String,
'ipv6Public' => String,
},
'status' => String,
'virtualIps' => [VIRTUAL_IP_FORMAT],
'created' => { 'time' => String },
'updated' => { 'time' => String }
}]
}
LOAD_BALANCERS_DETAIL_FORMAT = {
'loadBalancers' => [
{
'name' => String,
'id' => Integer,
'port' => Integer,
'protocol' => String,
'algorithm' => String,
'sourceAddresses' => SOURCE_ADDRESSES,
'status' => String,
'virtualIps' => [VIRTUAL_IP_FORMAT],
'nodes' => [SINGLE_NODE_FORMAT],
@ -106,11 +122,7 @@ LOAD_BALANCER_FORMAT = {
'port' => Integer,
'protocol' => String,
'algorithm' => String,
'sourceAddresses' => {
'ipv4Servicenet' => String,
'ipv4Public' => String,
'ipv6Public' => String,
},
'sourceAddresses' => SOURCE_ADDRESSES,
'status' => String,
'cluster' => { 'name' => String },
'virtualIps' => [VIRTUAL_IP_FORMAT],
@ -119,5 +131,3 @@ LOAD_BALANCER_FORMAT = {
'updated' => { 'time' => String },
}.merge(CONNECTION_LOGGING_FORMAT)
}

View file

@ -8,7 +8,7 @@ Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancer_tests', ['rackspace'
@lb_id = nil
@lb_name = 'fog' + Time.now.to_i.to_s
tests('#create_load_balancer(fog, )').formats(LOAD_BALANCER_FORMAT) do
tests("#create_load_balancer(#{@lb_name}, 'HTTP', 80,...)").formats(LOAD_BALANCER_FORMAT) do
data = @service.create_load_balancer(@lb_name, 'HTTP', 80, [{ :type => 'PUBLIC'}], [{ :address => '10.0.0.1', :port => 80, :condition => 'ENABLED'}]).body
@lb_id = data['loadBalancer']['id']
data

View file

@ -1,4 +1,4 @@
Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancer_tests', ['rackspace']) do
Shindo.tests('Fog::Rackspace::LoadBalancers | node_tests', ['rackspace']) do
pending if Fog.mocking?
@ -61,7 +61,11 @@ Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancer_tests', ['rackspace'
tests('get_node(0)').raises(Fog::Rackspace::LoadBalancers::NotFound) do
@service.get_node(@lb.id, 0)
end
tests('delete_node(0)').raises(Fog::Rackspace::LoadBalancers::NotFound) do
@service.delete_node(@lb.id, 0)
end
tests('delete_nodes(0)').raises(Fog::Rackspace::LoadBalancers::ServiceError) do
pending #Bug report filed with Rackspace. This currently returns 202 from their system but should return 400
@service.delete_nodes(@lb.id, 0)
end
tests('update_node(0)').raises(Fog::Rackspace::LoadBalancers::NotFound) do