diff --git a/.travis.yml b/.travis.yml index 025a5e0..c62af08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,12 @@ laguage: ruby + +before_install: + - spec/setup_kafka.sh + +env: KAFKA_PATH=./spec/kafka/ + +script: ./script/cibuild + rvm: - 1.9.3 - 2.0.0 @@ -10,4 +18,5 @@ rvm: matrix: allow_failures: - rvm: ruby-head + - rvm: jruby-head - rvm: rbx-19mode diff --git a/lib/poseidon/partition_consumer.rb b/lib/poseidon/partition_consumer.rb index a81b69c..7d72019 100644 --- a/lib/poseidon/partition_consumer.rb +++ b/lib/poseidon/partition_consumer.rb @@ -96,7 +96,9 @@ def fetch(options = {}) end topic_fetches = build_topic_fetch_request(fetch_max_bytes) + p "PRE FETCH: #{Time.now.to_i}" fetch_response = @connection.fetch(fetch_max_wait, fetch_min_bytes, topic_fetches) + p "POST FETCH: #{Time.now.to_i}" topic_response = fetch_response.topic_fetch_responses.first partition_response = topic_response.partition_fetch_responses.first diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 0000000..cd0a497 --- /dev/null +++ b/script/cibuild @@ -0,0 +1,2 @@ +#!/bin/sh +bundle exec rake spec:all diff --git a/spec/integration/simple/spec_helper.rb b/spec/integration/simple/spec_helper.rb index 5884122..fa2f388 100644 --- a/spec/integration/simple/spec_helper.rb +++ b/spec/integration/simple/spec_helper.rb @@ -8,7 +8,7 @@ JavaRunner.set_kafka_path! $tc = TestCluster.new $tc.start - sleep 5 + sleep 10 end config.after(:each) do diff --git a/spec/setup_kafka.sh b/spec/setup_kafka.sh new file mode 100755 index 0000000..cf30628 --- /dev/null +++ b/spec/setup_kafka.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +cd spec/ + +git clone https://github.com/apache/kafka.git +cd kafka +git checkout 0.8.1 +./gradlew -q jar diff --git a/spec/test_cluster.rb b/spec/test_cluster.rb index 8915629..e2f0393 100644 --- a/spec/test_cluster.rb +++ b/spec/test_cluster.rb @@ -60,12 +60,13 @@ def stop if !@stopped killed_at = Time.now loop do + puts `ps ax | grep java` if (pid = `#{@pid_cmd}`.to_i) == 0 SPEC_LOGGER.info "Killed." break end - if Time.now - killed_at > 30 + if Time.now - killed_at > 60 raise "Failed to kill process!" end @@ -94,7 +95,7 @@ def without_process def run FileUtils.mkdir_p(log_dir) - `LOG_DIR=#{log_dir} #{@start_cmd} #{config_path}` + system( { "LOG_DIR" => log_dir }, "#{@start_cmd} #{config_path}") @stopped = false end