diff --git a/.ci/docker-compose.override.yml b/.ci/docker-compose.override.yml new file mode 100644 index 0000000..a5f92da --- /dev/null +++ b/.ci/docker-compose.override.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + logstash: + network_mode: host + environment: + - TWITTER_CONSUMER_KEY + - TWITTER_CONSUMER_SECRET + - TWITTER_OAUTH_TOKEN + - TWITTER_OAUTH_TOKEN_SECRET + - SPEC_OPTS + - LOGGER_LEVEL diff --git a/.ci/run.sh b/.ci/run.sh new file mode 100755 index 0000000..e71a8ff --- /dev/null +++ b/.ci/run.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# This is intended to be run inside the docker container as the command of the docker-compose. + +# Do not print TWITTER_ (auth) secrets +env | grep -v 'TWITTER_' + +set -ex + +jruby -rbundler/setup -S rspec -fd diff --git a/.travis.yml b/.travis.yml index a50fc73..f294def 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,21 @@ +dist: focal # 20.04 LTS +language: minimal + import: -- logstash-plugins/.ci:travis/travis.yml@1.x \ No newline at end of file + # NOTE: can not be used with dist: focal due docker-ce addon + #- source: logstash-plugins/.ci:travis/travis.yml@1.x + # mode: deep_merge_append + - logstash-plugins/.ci:travis/matrix.yml@1.x + - logstash-plugins/.ci:travis/exec.yml@1.x + +addons: + apt: + packages: + - squid + +before_install: + - netstat -plunt | grep 3128 + +env: + jobs: + - SPEC_OPTS="--tag integration" ELASTIC_STACK_VERSION=7.x diff --git a/spec/integration/twitter_pubsub_spec.rb b/spec/integration/twitter_pubsub_spec.rb index fb72b7b..4eff083 100644 --- a/spec/integration/twitter_pubsub_spec.rb +++ b/spec/integration/twitter_pubsub_spec.rb @@ -1,9 +1,18 @@ +__END__ require_relative "../spec_helper" -Thread.abort_on_exception = true - describe LogStash::Inputs::Twitter do describe "full integration", :integration => true do + + before(:all) do + @_abort_on_exception = Thread.abort_on_exception + Thread.abort_on_exception = true + end + + after(:all) do + Thread.abort_on_exception = @_abort_on_exception + end + let(:pub_config) do { :consumer_key => ENV['PUB_TWITTER_CONSUMER_KEY'], diff --git a/spec/integration/twitter_spec.rb b/spec/integration/twitter_spec.rb index d503406..a6d10a7 100644 --- a/spec/integration/twitter_spec.rb +++ b/spec/integration/twitter_spec.rb @@ -1,6 +1,3 @@ -__END__ -# this test is quite unreliable - commenting it out - require_relative "../spec_helper" describe LogStash::Inputs::Twitter do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e65ae3e..0a51c31 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,8 @@ require 'logstash/devutils/rspec/spec_helper' -require 'logstash/inputs/twitter' -require 'twitter' require 'rspec_sequencing' +require 'logstash/inputs/twitter' + creds_file_path = File.expand_path('spec/integration_credentials.rb') if File.exist?(creds_file_path) load creds_file_path