deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [1/15] git commit: * server/tests/: play recordings back without any waiting
Date Tue, 28 Aug 2012 00:16:54 GMT
Updated Branches:
  refs/heads/master b6193c55f -> 001018be6


* server/tests/: play recordings back without any waiting

Some tests call wait_for so that when we are recording, we poll at a
reasonable rate. When running tests against recordings, there's no need to
do that; in fact we want to go as fast as possible.


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

Branch: refs/heads/master
Commit: 001018be6c684e24058b1da72ebb3365d2e331e8
Parents: 0bf2d11
Author: David Lutterkort <lutter@redhat.com>
Authored: Fri Aug 24 17:58:48 2012 -0700
Committer: David Lutterkort <lutter@redhat.com>
Committed: Mon Aug 27 14:47:17 2012 -0700

----------------------------------------------------------------------
 server/tests/drivers/ec2/common.rb            |    2 +-
 server/tests/drivers/gogrid/instances_test.rb |    3 +--
 server/tests/test_helper.rb                   |   12 +++++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/001018be/server/tests/drivers/ec2/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/common.rb b/server/tests/drivers/ec2/common.rb
index 0d6b608..a8a5471 100644
--- a/server/tests/drivers/ec2/common.rb
+++ b/server/tests/drivers/ec2/common.rb
@@ -19,5 +19,5 @@ VCR.configure do |c|
   matcher = VCR.request_matchers.uri_without_param("AWSAccessKeyId",
                                                    "Signature", "Timestamp")
   c.register_request_matcher(:ec2_matcher, &matcher)
-  c.default_cassette_options = { :record => :new_episodes, :match_requests_on => [:method,
:ec2_matcher] }
+  c.default_cassette_options = { :record => :none, :match_requests_on => [:method,
:ec2_matcher] }
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/001018be/server/tests/drivers/gogrid/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/gogrid/instances_test.rb b/server/tests/drivers/gogrid/instances_test.rb
index a967122..52e8e13 100644
--- a/server/tests/drivers/gogrid/instances_test.rb
+++ b/server/tests/drivers/gogrid/instances_test.rb
@@ -35,8 +35,7 @@ describe 'GoGridDriver Instances' do
     driver = Deltacloud::new(:gogrid, credentials)
 
     # Go fast when running off a recording
-    opts = record_retries
-    opts[:time_between_retry] = VCR.configuration.default_cassette_options[:record] == :none
? 0 : 60
+    opts = record_retries('', :time_between_retry => 60)
     @@instance.wait_for!(driver, opts) do |i|
       i.actions.include?(:destroy)
     end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/001018be/server/tests/test_helper.rb
----------------------------------------------------------------------
diff --git a/server/tests/test_helper.rb b/server/tests/test_helper.rb
index 75c69d9..57b7fb3 100644
--- a/server/tests/test_helper.rb
+++ b/server/tests/test_helper.rb
@@ -20,12 +20,14 @@ if ENV['COVERAGE']
   end
 end
 
-def record_retries(name='')
-  {
-    :before => Proc.new { |r, &block|
-      VCR.use_cassette("#{__name__}-#{name.empty? ? '' : "#{name}-"}#{r}", &block)
-    }
+def record_retries(name='', opts = {})
+  opts[:before] = Proc.new { |r, &block|
+    VCR.use_cassette("#{__name__}-#{name.empty? ? '' : "#{name}-"}#{r}", &block)
   }
+  if VCR.configuration.default_cassette_options[:record] == :none
+    opts[:time_between_retry] = 0
+  end
+  opts
 end
 
 include Rack::Test::Methods


Mime
View raw message