Skip to content

Commit 0ff700a

Browse files
committed
Fix unit test for Ruby 2.2
1 parent e105c0e commit 0ff700a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

stackdriver-core/test/stackdriver/core/async_actor_test.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,20 @@ def start_thread &block
215215
end
216216

217217
it "doesn't wait if timeout is 0" do
218-
actor.async_start
218+
thread_running = false
219+
actor.define_singleton_method :run_backgrounder do
220+
loop { thread_running = true }
221+
end
219222

220-
actor.send :set_cleanup_options, timeout: 0
223+
actor.async_start
221224

225+
wait_result = wait_until_true do
226+
thread_running
227+
end
228+
wait_result.must_equal :completed
222229
actor.async_stopped?.must_equal false
230+
231+
actor.send :set_cleanup_options, timeout: 0
223232
stop = actor.async_stop!
224233
stop.must_equal :forced
225234
actor.async_stopped?.must_equal true

0 commit comments

Comments
 (0)