Sha256: 1ba94649ba0af7e698398529ab197ec89030eff305e902813dcc611bad09e98d

Contents?: true

Size: 1002 Bytes

Versions: 3

Compression:

Stored size: 1002 Bytes

Contents

require File.expand_path('../integration_test', __FILE__)

module Propono
  class UdpToSqsTest < IntegrationTest
    def test_the_message_gets_there
      topic = "test-topic"
      message = "This is my message"
      Propono.config.tcp_host = "localhost"
      Propono.config.tcp_port = 20009

      Propono.subscribe_by_queue(topic)

      sqs_thread = Thread.new do
        Propono.listen_to_queue(topic) do |sqs_message|
          assert_equal message, sqs_message
          sqs_thread.terminate
        end
      end

      tcp_thread = Thread.new do
        Propono.listen_to_tcp do |tcp_topic, tcp_message|
          Propono.publish(tcp_topic, tcp_message)
          tcp_thread.terminate
        end
      end
      sleep(2) # Make sure the listener has started

      Propono.publish(topic, message, protocol: :tcp)
      flunk("Test Timeout") unless wait_for_thread(tcp_thread) && wait_for_thread(sqs_thread)
    ensure
      tcp_thread.terminate
      sqs_thread.terminate
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
propono-0.8.2 test/integration/tcp_to_sqs_test.rb
propono-0.8.0 test/integration/tcp_to_sqs_test.rb
propono-0.7.0 test/integration/tcp_to_sqs_test.rb