deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject git commit: Black box tests - check if collection supported before creating test resource
Date Thu, 24 Jan 2013 17:02:49 GMT
Updated Branches:
  refs/heads/master 1bf34b8d4 -> ab0183f6d


Black box tests - check if collection supported before creating test resource


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

Branch: refs/heads/master
Commit: ab0183f6dbf3f1e2b716f3ed6f735799ced4729c
Parents: 1bf34b8
Author: marios <marios@redhat.com>
Authored: Thu Jan 24 13:11:53 2013 +0200
Committer: marios <marios@redhat.com>
Committed: Thu Jan 24 19:02:27 2013 +0200

----------------------------------------------------------------------
 tests/deltacloud/buckets_test.rb   |    2 +-
 tests/deltacloud/instances_test.rb |    2 +-
 tests/deltacloud/test_setup.rb     |    7 +++++++
 3 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ab0183f6/tests/deltacloud/buckets_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/buckets_test.rb b/tests/deltacloud/buckets_test.rb
index 38fc120..c9ac7f5 100644
--- a/tests/deltacloud/buckets_test.rb
+++ b/tests/deltacloud/buckets_test.rb
@@ -50,7 +50,7 @@ describe 'Deltacloud API buckets collection' do
     unless res.code == 200
       raise Exception.new("Failed to create blob #{@@my_blob}")
     end
-  end
+  end if collection_supported :buckets
 
   # delete the bucket/blob we created for the tests
   MiniTest::Unit.after_tests {

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ab0183f6/tests/deltacloud/instances_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/instances_test.rb b/tests/deltacloud/instances_test.rb
index d6a916c..73b5ed2 100644
--- a/tests/deltacloud/instances_test.rb
+++ b/tests/deltacloud/instances_test.rb
@@ -33,7 +33,7 @@ describe 'Deltacloud API instances collection' do
     end
     @@my_instance_id = (res.xml/'instance')[0][:id]
     @@created_resources[:instances] << @@my_instance_id
-  end
+  end if collection_supported :instances
 
   #stop/destroy the resources we created for the tests
   MiniTest::Unit.after_tests {

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ab0183f6/tests/deltacloud/test_setup.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/test_setup.rb b/tests/deltacloud/test_setup.rb
index c75b046..b28e456 100644
--- a/tests/deltacloud/test_setup.rb
+++ b/tests/deltacloud/test_setup.rb
@@ -237,6 +237,13 @@ module Deltacloud::Test::Methods
       end
     end
 
+    #convenience method for checking if collection :foo is supported:
+    def collection_supported(name)
+      return true if api.collections.include?(name.to_sym)
+      false
+    end
+
+
     # Only run tests if collection +collection+ supports feature +name+ in
     # the current driver. Use inside a 'describe' block. Tests that are not
     # run because of a missing collection are marked as skipped


Mime
View raw message