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/05 20:17:59 UTC

[PATCH] Deltacloud - Tests - adding code to create load balancer needed for test

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

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

diff --git a/tests/deltacloud/load_balancers_test.rb b/tests/deltacloud/load_balancers_test.rb
index f975be8..2b27502 100644
--- a/tests/deltacloud/load_balancers_test.rb
+++ b/tests/deltacloud/load_balancers_test.rb
@@ -22,6 +22,28 @@ describe 'Deltacloud API load_balancers collection' do
 
   need_collection :load_balancers
 
+  LOAD_BALANCERS = "/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
+
+  #Delete the load_balancer we created for the tests
+  MiniTest::Unit.after_tests {
+  if collection_supported :load_balancer
+    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