[core] Make the wait timeout truly global

The Rackspace helper changed the Fog.timeout global for all live tests
so the core test which expected "600" failed since it was now "2000"

Since it is a global setting it has been moved to the global test helper

It can now also be controlled by the FOG_TEST_TIMEOUT env variable.
This commit is contained in:
Paul Thornthwaite 2014-02-19 09:34:00 +00:00
parent 365412d6ea
commit 43c4531763
3 changed files with 13 additions and 10 deletions

View File

@ -1,5 +1,5 @@
Shindo.tests('Fog#timeout', 'core') do
tests('timeout').returns(600) do
tests('timeout').returns(FOG_TESTING_TIMEOUT) do
Fog.timeout
end

View File

@ -21,6 +21,15 @@ Excon.defaults.merge!(:debug_request => true, :debug_response => true)
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper'))
# This overrides the default 600 seconds timeout during live test runs
if Fog.mocking?
FOG_TESTING_TIMEOUT = ENV['FOG_TEST_TIMEOUT'] || 2000
Fog.timeout = 2000
Fog::Logger.warning "Setting default fog timeout to #{Fog.timeout} seconds"
else
FOG_TESTING_TIMEOUT = Fog.timeout
end
def lorem_file
File.open(File.dirname(__FILE__) + '/lorem.txt', 'r')
end

View File

@ -5,17 +5,11 @@ LINKS_FORMAT = [{
module Shindo
class Tests
unless Fog.mocking?
Fog.timeout = 2000
Fog::Logger.warning "Setting default fog timeout to #{Fog.timeout} seconds"
end
def given_a_load_balancer_service(&block)
@service = Fog::Rackspace::LoadBalancers.new
instance_eval(&block)
end
def given_a_load_balancer(&block)
@lb = @service.load_balancers.create({
:name => ('fog' + Time.now.to_i.to_s),
@ -32,7 +26,7 @@ module Shindo
@lb.destroy
end
end
def wait_for_request(description = "waiting", &block)
return if Fog.mocking?
tests(description) do
@ -96,4 +90,4 @@ module Shindo
return true
end
end
end
end