diff --git a/lib/fog/core/mock.rb b/lib/fog/core/mock.rb index 6847d56b5..9b19d0eb9 100644 --- a/lib/fog/core/mock.rb +++ b/lib/fog/core/mock.rb @@ -21,6 +21,16 @@ module Fog @delay end + @timeout = 600 + def self.timeout + @timeout + end + + def self.timeout=(new_timeout) + raise ArgumentError, "timeout must be non-negative" unless new_timeout >= 0 + @timeout = new_timeout + end + def self.delay=(new_delay) raise ArgumentError, "delay must be non-negative" unless new_delay >= 0 @delay = new_delay diff --git a/lib/fog/core/model.rb b/lib/fog/core/model.rb index 307472042..6143d90fa 100644 --- a/lib/fog/core/model.rb +++ b/lib/fog/core/model.rb @@ -42,7 +42,7 @@ module Fog attributes.to_json end - def wait_for(timeout=600, interval=1, &block) + def wait_for(timeout=Fog::Mock.timeout, interval=1, &block) reload retries = 3 Fog.wait_for(timeout, interval) do diff --git a/lib/fog/core/wait_for.rb b/lib/fog/core/wait_for.rb index 3a9133b32..685298c75 100644 --- a/lib/fog/core/wait_for.rb +++ b/lib/fog/core/wait_for.rb @@ -1,6 +1,6 @@ module Fog - def self.wait_for(timeout=600, interval=1, &block) + def self.wait_for(timeout=Fog::Mock.timeout, interval=1, &block) duration = 0 start = Time.now until yield || duration > timeout @@ -14,4 +14,4 @@ module Fog end end -end \ No newline at end of file +end