You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by rl...@redhat.com on 2013/04/12 15:41:51 UTC

[PATCH] Deltacloud Tests - adding load balancer for testing

From: Ronelle Landy <rl...@redhat.com>

---
 tests/deltacloud/load_balancers_test.rb | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/deltacloud/load_balancers_test.rb b/tests/deltacloud/load_balancers_test.rb
index f975be8..b995caf 100644
--- a/tests/deltacloud/load_balancers_test.rb
+++ b/tests/deltacloud/load_balancers_test.rb
@@ -22,6 +22,31 @@ describe 'Deltacloud API load_balancers collection' do
 
   need_collection :load_balancers
 
+  LOAD_BALANCERS = "/load_balancers"
+
+  if collection_supported :load_balancers
+    #Create a load_balancer
+    res = post(LOAD_BALANCERS, :name => "loadBalancerForTest",
+       :listener_protocol => "HTTP",
+       :listener_balancer_port => "80",
+       :listener_instance_port => "3010",
+       :realm_id => get_a("realm"))
+
+    unless res.code == 201
+      raise Exception.new("Failed to create load balancer")
+    end
+  end
+
+  #Delete the load_balancer we created for the tests
+  MiniTest::Unit.after_tests {
+  if collection_supported :load_balancers
+    res = delete(LOAD_BALANCERS + "/loadBalancerForTest")
+    unless res.code == 204
+     raise Exception.new("Failed to delete load balancer")
+    end
+  end
+  }
+
   #Run the 'common' tests for all collections defined in common_tests_collections.rb
   CommonCollectionsTest::run_collection_and_member_tests_for("load_balancers")
 
-- 
1.8.1.4