Sha256: ef0d3890e34a32e96df6151287df104e6d3ee01a9a83705956795f039db56d0a

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 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.udp_port = 20002

      Propono.subscribe_by_queue(topic)

      udp_thread = Thread.new do
        Propono.listen_to_udp do |udp_topic, udp_message|
          Propono.publish(udp_topic, udp_message)
          udp_thread.terminate
        end
      end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
propono-0.6.3 test/integration/udp_to_sqs_test.rb