diff --git a/test/unit/dispatcher_test.rb b/test/unit/dispatcher_test.rb index 7df0591f..8bf85147 100644 --- a/test/unit/dispatcher_test.rb +++ b/test/unit/dispatcher_test.rb @@ -38,15 +38,17 @@ class DispatcherTest < ActiveSupport::TestCase test "polling queries are logged" do log = StringIO.new + polling_query = /SELECT .* FROM .solid_queue_scheduled_executions. WHERE/ + with_active_record_logger(ActiveSupport::Logger.new(log)) do with_polling(silence: false) do rewind_io(log) @dispatcher.start - sleep 0.5.second + wait_while_with_timeout(3.seconds) { !log.string.match?(polling_query) } end end - assert_match /SELECT .* FROM .solid_queue_scheduled_executions. WHERE/, log.string + assert_match polling_query, log.string end test "polling queries can be silenced" do diff --git a/test/unit/worker_test.rb b/test/unit/worker_test.rb index c21cd574..8907d916 100644 --- a/test/unit/worker_test.rb +++ b/test/unit/worker_test.rb @@ -146,14 +146,16 @@ class WorkerTest < ActiveSupport::TestCase test "polling queries are logged" do log = StringIO.new + polling_query = /SELECT .* FROM .solid_queue_ready_executions. WHERE .solid_queue_ready_executions...queue_name./ + with_active_record_logger(ActiveSupport::Logger.new(log)) do with_polling(silence: false) do @worker.start - sleep 0.2 + wait_while_with_timeout(3.seconds) { !log.string.match?(polling_query) } end end - assert_match /SELECT .* FROM .solid_queue_ready_executions. WHERE .solid_queue_ready_executions...queue_name./, log.string + assert_match polling_query, log.string end test "polling queries can be silenced" do