Merge pull request #67 from lookout/fix_integration

Fix integration tests
This commit is contained in:
R. Tyler Croy 2014-10-28 12:32:20 -07:00
commit 0cd921298e
1 changed files with 27 additions and 22 deletions

View File

@ -5,34 +5,39 @@ require 'hermann/consumer'
require 'hermann/discovery/zookeeper'
require 'concurrent'
class ConsumerTest
def create_consumer
zookeeper = "localhost:2181"
groupId = "group1"
topic = 'test'
consumer = Hermann::Consumer.new(topic, groupId, zookeeper)
if Hermann.jruby?
consumer.consume(topic) do |msg|
if msg == 'msg'
consumer.shutdown
return true
class ConsumerTest
def create_consumer
zookeeper = "localhost:2181"
groupId = "group1"
topic = 'test'
consumer = Hermann::Consumer.new(topic, groupId, zookeeper)
consumer.consume(topic) do |msg|
if msg == 'msg'
consumer.shutdown
return true
end
end
false
end
false
end
end
describe 'producer' do
include_context 'integration test context'
describe 'producer' do
include_context 'integration test context'
let(:message) { 'msg' }
let(:message) { 'msg' }
it 'produces and consumes messages', :type => :integration do
test_consumer = Concurrent::Promise.execute { ConsumerTest.new.create_consumer }
broker_ids = Hermann::Discovery::Zookeeper.new(zookeepers).get_brokers
producer = Hermann::Producer.new(nil, broker_ids)
producer.push(message, :topic => topic).wait(1)
expect(test_consumer.value(1)).to be true
it 'produces and consumes messages', :type => :integration, :platform => :java do
test_consumer = Concurrent::Promise.execute { ConsumerTest.new.create_consumer }
broker_ids = Hermann::Discovery::Zookeeper.new(zookeepers).get_brokers
producer = Hermann::Producer.new(nil, broker_ids)
producer.push(message, :topic => topic).wait(1)
expect(test_consumer.value(1)).to be true
end
end
end
end