test/integration/slow_queue_test.rb in propono-1.7.0 vs test/integration/slow_queue_test.rb in propono-2.0.0.rc1

- old
+ new

@@ -9,20 +9,22 @@ slow_text = "This is my slow message #{DateTime.now} #{rand()}" flunks = [] message_received = false slow_message_received = false - Propono.drain_queue(slow_topic) - Propono.drain_queue(topic) - Propono.subscribe_by_queue(topic) + propono_client.drain_queue(topic) + propono_client.drain_queue(slow_topic) + propono_client.subscribe(topic) + thread = Thread.new do begin - Propono.listen_to_queue(topic) do |message, context| + propono_client.listen(topic) do |message, context| flunks << "Wrong message" unless (message == text || message == slow_text) message_received = true if message == text slow_message_received = true if message == slow_text + thread.terminate if message_received && slow_message_received end rescue => e flunks << e.message ensure thread.terminate @@ -36,14 +38,15 @@ thread.terminate end sleep(1) # Make sure the listener has started - Propono.publish(slow_topic, slow_text, async: false) - Propono.publish(topic, text, async: false) - flunks << "Test Timeout" unless wait_for_thread(thread) + propono_client.publish(slow_topic, slow_text) + propono_client.publish(topic, text) + + flunks << "Test Timeout" unless wait_for_thread(thread, 60) flunk(flunks.join("\n")) unless flunks.empty? ensure - # thread.terminate + thread.terminate if thread end end end