From d7fa80f7022c4e0169818bb87a0f22539bc03dee Mon Sep 17 00:00:00 2001 From: Paul Thornthwaite Date: Mon, 3 Oct 2011 11:49:07 +0100 Subject: [PATCH] [brightbox] Load balancer request tests expanded --- .../requests/compute/load_balancer_tests.rb | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/brightbox/requests/compute/load_balancer_tests.rb b/tests/brightbox/requests/compute/load_balancer_tests.rb index a0d436aa8..9a7bea617 100644 --- a/tests/brightbox/requests/compute/load_balancer_tests.rb +++ b/tests/brightbox/requests/compute/load_balancer_tests.rb @@ -45,6 +45,48 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox']) formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result } end + update_options = {:name => "New name"} + tests("#update_load_balancer('#{@load_balancer_id}', #{update_options.inspect})") do + pending if Fog.mocking? + result = Fog::Compute[:brightbox].update_load_balancer(@load_balancer_id, update_options) + formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result } + end + + add_listeners_options = {:listeners=>[{:out=>28080, :in=>8080, :protocol=>"http"}]} + tests("#add_listeners_load_balancer('#{@load_balancer_id}', #{add_listeners_options.inspect})") do + pending if Fog.mocking? + result = Fog::Compute[:brightbox].add_listeners_load_balancer(@load_balancer_id, add_listeners_options) + formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result } + end + + remove_listeners_options = {:listeners=>[{:out=>28080, :in=>8080, :protocol=>"http"}]} + tests("#remove_listeners_load_balancer('#{@load_balancer_id}', #{remove_listeners_options.inspect})") do + pending if Fog.mocking? + result = Fog::Compute[:brightbox].remove_listeners_load_balancer(@load_balancer_id, remove_listeners_options) + formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result } + end + + unless Fog.mocking? + @node2 = Brightbox::Compute::TestSupport.get_test_server + second_node_id = @node2.id + end + + # Can't remove the last node so we need to add a second... + add_nodes_options = {:nodes => [{:node => second_node_id}]} + tests("#add_nodes_load_balancer('#{@load_balancer_id}', #{add_nodes_options.inspect})") do + pending if Fog.mocking? + result = Fog::Compute[:brightbox].add_nodes_load_balancer(@load_balancer_id, add_nodes_options) + formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result } + end + + # ...before we can attempt to remove either + remove_nodes_options = {:nodes => [{:node => node_id}]} + tests("#remove_nodes_load_balancer('#{@load_balancer_id}', #{remove_nodes_options.inspect})") do + pending if Fog.mocking? + result = Fog::Compute[:brightbox].remove_nodes_load_balancer(@load_balancer_id, remove_nodes_options) + formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result } + end + tests("#destroy_load_balancer('#{@load_balancer_id}')") do pending if Fog.mocking? result = Fog::Compute[:brightbox].destroy_load_balancer(@load_balancer_id) @@ -53,6 +95,7 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox']) unless Fog.mocking? @node.destroy + @node2.destroy end end