Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 15:26:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 15:26:25 +0300
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /scripts/gitaly_test.rb
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'scripts/gitaly_test.rb')
-rw-r--r--scripts/gitaly_test.rb23
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