deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/2] git commit: CIMI - Tests - modfiying test_helper.rb cleanup code to work with Openstack provider
Date Tue, 09 Apr 2013 10:27:30 GMT
Updated Branches:
  refs/remotes/apache/master 3d6e08c08 -> ca47929c0


CIMI - Tests - modfiying test_helper.rb cleanup code to work with Openstack provider

TrackedAt: http://tracker.deltacloud.org/patch/1e5a6656b4f4eeaf278bf60efd812b9bf9682611


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/8dfb3405
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/8dfb3405
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/8dfb3405

Branch: refs/remotes/apache/master
Commit: 8dfb3405e093bccc142c08ed058b8b3ec30edbc3
Parents: 3d6e08c
Author: Ronelle Landy <rlandy@redhat.com>
Authored: Thu Apr 4 13:15:39 2013 -0400
Committer: marios <marios@redhat.com>
Committed: Tue Apr 9 12:42:00 2013 +0300

----------------------------------------------------------------------
 tests/cimi/test_helper.rb |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/8dfb3405/tests/cimi/test_helper.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
index 5cfceb6..19f0b2c 100644
--- a/tests/cimi/test_helper.rb
+++ b/tests/cimi/test_helper.rb
@@ -346,17 +346,24 @@ module CIMI::Test::Methods
             machine = get(machine.json["id"], :accept => :json)
           end
 
-          while not machine.json["state"].upcase.eql?("STOPPED")
+          cep_json = cep(:accept => :json)
+          while (get(cep_json.json["machines"]["href"], {:accept=>:json}).include?(machine.json["id"])
&& (not machine.json["state"].upcase.eql?("STOPPED"))
             puts 'waiting for machine to be STOPPED'
-            sleep(1)
-            machine = get(machine.json["id"], :accept => :json)
+            sleep(3)
+            unless (not get(cep_json.json["machines"]["href"], {:accept=>:json}).include?(machine.json["id"]))
+              machine = get(machine.json["id"], :accept => :json)
+            end
           end
 
-          delete_op = machine.json["operations"].find { |op| op["rel"] =~ /delete$/ }
-          if delete_op
-            delete_res = RestClient.delete( delete_op["href"],
-                {'Authorization' => api_basic_auth, :accept => :json} )
-            @@created_resources[:machines][i] = nil if (200..207).include? delete_res.code
+          if get(cep_json.json["machines"]["href"], {:accept=>:json}).include?(machine.json["id"])
+            delete_op = machine.json["operations"].find { |op| op["rel"] =~ /delete$/ }
+            if delete_op
+              delete_res = RestClient.delete( delete_op["href"],
+                  {'Authorization' => api_basic_auth, :accept => :json} )
+              @@created_resources[:machines][i] = nil if (200..207).include? delete_res.code
+            end
+          else
+            @@created_resources[:machines][i] = nil
           end
         end
 


Mime
View raw message