diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-25 21:08:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-25 21:08:50 +0300 |
commit | ad7ce32986c4b9e4af87c2895ef9a867cc5bb356 (patch) | |
tree | e8a8e9291434658484024ff00e236908123eb037 /scripts | |
parent | 65f5f75e3a3b0b9f4ea6035294f81977fa8a2bb5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gitaly_test.rb | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/scripts/gitaly_test.rb b/scripts/gitaly_test.rb index c69c4ea747b..54bf07b3773 100644 --- a/scripts/gitaly_test.rb +++ b/scripts/gitaly_test.rb @@ -6,8 +6,16 @@ require 'securerandom' require 'socket' +require 'logger' module GitalyTest + LOGGER = begin + default_name = ENV['CI'] ? 'DEBUG' : 'WARN' + level_name = ENV['GITLAB_TESTING_LOG_LEVEL']&.upcase + level = Logger.const_get(level_name || default_name, true) # rubocop: disable Gitlab/ConstGetInheritFalse + Logger.new(STDOUT, level: level, formatter: ->(_, _, _, msg) { msg }) + end + def tmp_tests_gitaly_dir File.expand_path('../tmp/tests/gitaly', __dir__) end @@ -98,7 +106,7 @@ module GitalyTest end def check_gitaly_config! - puts "Checking gitaly-ruby Gemfile..." + LOGGER.debug "Checking gitaly-ruby Gemfile...\n" unless File.exist?(gemfile) message = "#{gemfile} does not exist." @@ -106,8 +114,9 @@ module GitalyTest abort message end - puts 'Checking gitaly-ruby bundle...' - abort 'bundle check failed' unless system(env, 'bundle', 'check', chdir: File.dirname(gemfile)) + LOGGER.debug "Checking gitaly-ruby bundle...\n" + out = ENV['CI'] ? STDOUT : '/dev/null' + abort 'bundle check failed' unless system(env, 'bundle', 'check', out: out, chdir: File.dirname(gemfile)) end def read_socket_path(service) @@ -126,22 +135,22 @@ module GitalyTest end def try_connect!(service) - print "Trying to connect to #{service}: " + LOGGER.debug "Trying to connect to #{service}: " timeout = 20 delay = 0.1 socket = read_socket_path(service) Integer(timeout / delay).times do UNIXSocket.new(socket) - puts ' OK' + LOGGER.debug " OK\n" return rescue Errno::ENOENT, Errno::ECONNREFUSED - print '.' + LOGGER.debug '.' sleep delay end - puts ' FAILED' + LOGGER.warn " FAILED to connect to #{service}\n" raise "could not connect to #{socket}" end |