deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [5/5] git commit: CIMI tests: make cimi system scenario more generic and work on fgcp
Date Thu, 25 Apr 2013 00:10:22 GMT
CIMI tests: make cimi system scenario more generic and work on fgcp


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

Branch: refs/heads/master
Commit: cc6f9a3cb8d2ffbe3aba46876e31ada305cd92c2
Parents: 1571178
Author: Dies Koper <diesk@fast.au.fujitsu.com>
Authored: Wed Apr 24 14:57:16 2013 -0700
Committer: David Lutterkort <lutter@redhat.com>
Committed: Wed Apr 24 17:01:12 2013 -0700

----------------------------------------------------------------------
 tests/cimi/system1_test.rb |    6 +++++-
 tests/cimi/test_helper.rb  |    7 +++----
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/cc6f9a3c/tests/cimi/system1_test.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/system1_test.rb b/tests/cimi/system1_test.rb
index b3681bf..4b21961 100644
--- a/tests/cimi/system1_test.rb
+++ b/tests/cimi/system1_test.rb
@@ -132,6 +132,8 @@ class SystemTemplate < CIMI::Test::Spec
   # 1.10 Starting the new System
   it "should be able to start the system", :only => :json  do
     test_system_created = get(fetch(system_created.headers[:location]).id, :accept =>
:json)
+    # ensure the system has reached a stable state (STOPPED, MIXED or STARTED)
+    poll_state(fetch(system_created.headers[:location]), "STARTED", "STOPPED", "MIXED")
     unless test_system_created.json["state"].eql?("STARTED")
       uri = discover_uri_for("start", "", test_system_created.json["operations"])
       response = post( uri,
@@ -157,7 +159,9 @@ class SystemTemplate < CIMI::Test::Spec
   # 1.12 Stop the new System
   it "should be able to stop the system", :only => :json  do
     test_system_created = get(fetch(system_created.headers[:location]).id, :accept =>
:json)
-    unless test_system_created.json["state"].eql?("STOPPED")
+    # ensure the system has reached a stable state (STOPPED, MIXED or STARTED)
+    poll_state(fetch(system_created.headers[:location]), "STARTED", "STOPPED", "MIXED")
+    unless test_system_created.json["state"].upcase.eql?("STOPPED")
       uri = discover_uri_for("stop", "", test_system_created.json["operations"])
       response = post( uri,
             "<Action xmlns=\"http://schemas.dmtf.org/cimi/1\">" +

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/cc6f9a3c/tests/cimi/test_helper.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
index 316b461..a1bdb76 100644
--- a/tests/cimi/test_helper.rb
+++ b/tests/cimi/test_helper.rb
@@ -256,10 +256,9 @@ module CIMI::Test::Methods
       log.debug "/#{method.to_s.upcase} #{absolute_url(path)}"
     end
 
-    def poll_state(res, state)
-      while not res.state.upcase.eql?(state)
-        puts state
-        log.info "waiting for resource #{res.id} to be #{state}"
+    def poll_state(res, *states)
+      while not states.include?(res.state.upcase)
+        log.info "waiting for resource #{res.id} to go from #{res.state} to #{states}"
         sleep(10)
         res = fetch(res.id)
       end


Mime
View raw message