From d2ad2557a255eed9819e8e3b9d7e3540c0fa6cb2 Mon Sep 17 00:00:00 2001 From: Circle CI Automated Builder Date: Mon, 21 Mar 2016 22:16:52 +0100 Subject: [PATCH] New trial for better testing stability on Travis CI --- .rubocop.yml | 2 ++ spec/acceptance/100_integration_spec.rb | 3 +++ spec/spec_helper.rb | 2 +- spec/support/helpers/docker_helper.rb | 9 +++++++-- spec/support/matchers/wait_for_console_matcher.rb | 4 ++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 33759ff..cbee569 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,8 @@ AllCops: - 'tmp/**/*' TargetRubyVersion: 2.2 +Metrics/AbcSize: + Enabled: false Metrics/LineLength: Enabled: false diff --git a/spec/acceptance/100_integration_spec.rb b/spec/acceptance/100_integration_spec.rb index 48f5690..17353a1 100644 --- a/spec/acceptance/100_integration_spec.rb +++ b/spec/acceptance/100_integration_spec.rb @@ -26,6 +26,7 @@ if ENV['CIRCLECI'] @container_db.kill signal: 'SIGKILL' unless @container_db.nil? else + @container_db.kill signal: 'SIGKILL' unless @container_db.nil? @container_db.remove force: true, v: true unless @container_db.nil? end end @@ -54,6 +55,7 @@ if ENV['CIRCLECI'] @container_db.kill signal: 'SIGKILL' unless @container_db.nil? else + @container_db.kill signal: 'SIGKILL' unless @container_db.nil? @container_db.remove force: true, v: true unless @container_db.nil? end end @@ -84,6 +86,7 @@ if ENV['CIRCLECI'] @container_proxy.kill signal: 'SIGKILL' unless @container_proxy.nil? else + @container_proxy.kill signal: 'SIGKILL' unless @container_proxy.nil? @container_proxy.remove force: true, v: true unless @container_proxy.nil? end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ee50509..2206a0c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ REGEX_WARN = /WARNING|WARN/ REGEX_ERROR = /ERROR|ERR/ REGEX_SEVERE = /SEVERE|FATAL/ -REGEX_STARTUP = /Server startup in \d+ ms/ +REGEX_STARTUP = /Server startup in (\d+) ms/ REGEX_FILTER = Regexp.compile Regexp.union [ /Bundle\ org\.springframework\.osgi\.extender\ \[.*\]\ EventDispatcher:\ Error\ during\ dispatch\.\ \(java\.lang\.NullPointerException\)/, /The\ executor\ associated\ with\ thread\ pool\ \[http\-bio\-8090\]\ has\ not\ fully\ shutdown\.\ Some\ application\ threads\ may\ still\ be\ running\./, diff --git a/spec/support/helpers/docker_helper.rb b/spec/support/helpers/docker_helper.rb index 2c4dac3..b898309 100644 --- a/spec/support/helpers/docker_helper.rb +++ b/spec/support/helpers/docker_helper.rb @@ -33,13 +33,18 @@ def wait_for_output(regex) thread = Thread.new do timeout(Docker::DSL.timeout) do Thread.handle_interrupt(TimeoutError => :on_blocking) do - streaming_logs stdout: true, stderr: true, tail: 'all', follow: true do |_, chunk| - Thread.exit if chunk =~ regex + streaming_logs stdout: true, stderr: true, follow: true do |stream, chunk| + puts "[#{stream}] #{chunk}" if ENV['TRAVIS'] + if chunk =~ regex + Thread.current[:chunk] = chunk + Thread.exit + end end end end end thread.join + thread[:chunk].to_s.match(regex).to_a.drop 1 end end end diff --git a/spec/support/matchers/wait_for_console_matcher.rb b/spec/support/matchers/wait_for_console_matcher.rb index 23c9b27..eabfa5f 100644 --- a/spec/support/matchers/wait_for_console_matcher.rb +++ b/spec/support/matchers/wait_for_console_matcher.rb @@ -14,11 +14,11 @@ def initialize(expected, options = {}) end def matches?(actual) - actual.wait_for_output @expected + @value = actual.wait_for_output @expected end def description - "wait for match #{@expected.inspect} in console output" + "wait for match #{@expected.inspect} in console output #{@value}" end end