File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -161,19 +161,21 @@ def test_client_retry_after_seconds
161161 end
162162
163163 def test_client_retry_after_date
164+ time_now = Time . now
165+
164166 stub_request ( :get , "http://localhost/containers/json" ) . to_return_json (
165167 status : 500 ,
166- headers : { "retry-after" => ( Time . now + 10 ) . httpdate } ,
168+ headers : { "retry-after" => ( time_now + 10 ) . httpdate } ,
167169 body : { }
168170 )
169171
170172 docker = DockerEngineRuby ::Client . new ( base_url : "http://localhost" , max_retries : 1 )
171173
174+ Thread . current . thread_variable_set ( :time_now , time_now )
172175 assert_raises ( DockerEngineRuby ::Errors ::InternalServerError ) do
173- Thread . current . thread_variable_set ( :time_now , Time . now )
174176 docker . containers . list
175- Thread . current . thread_variable_set ( :time_now , nil )
176177 end
178+ Thread . current . thread_variable_set ( :time_now , nil )
177179
178180 assert_requested ( :any , /./ , times : 2 )
179181 assert_in_delta ( 10 , Thread . current . thread_variable_get ( :mock_sleep ) . last , 1.0 )
You can’t perform that action at this time.
0 commit comments