Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9a7b4506
Commit
9a7b4506
authored
Jun 25, 2020
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ajk-quiet-tests' into 'master'
Allow tests to be quiet See merge request gitlab-org/gitlab!34020
parents
63986a76
5c6ae5e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
13 deletions
+22
-13
scripts/gitaly_test.rb
scripts/gitaly_test.rb
+16
-7
spec/support/helpers/test_env.rb
spec/support/helpers/test_env.rb
+6
-6
No files found.
scripts/gitaly_test.rb
View file @
9a7b4506
...
...
@@ -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
...
...
spec/support/helpers/test_env.rb
View file @
9a7b4506
...
...
@@ -169,8 +169,9 @@ module TestEnv
task:
"gitlab:gitaly:install[
#{
install_gitaly_args
}
]"
)
do
Gitlab
::
SetupHelper
::
Gitaly
.
create_configuration
(
gitaly_dir
,
{
'default'
=>
repos_path
},
force:
true
)
Gitlab
::
SetupHelper
::
Praefect
.
create_configuration
(
gitaly_dir
,
{
'praefect'
=>
repos_path
},
force:
true
)
start_gitaly
(
gitaly_dir
)
end
start_gitaly
(
gitaly_dir
)
end
def
gitaly_socket_path
...
...
@@ -463,7 +464,6 @@ module TestEnv
end
def
component_timed_setup
(
component
,
install_dir
:,
version
:,
task
:)
puts
"
\n
==> Setting up
#{
component
}
..."
start
=
Time
.
now
ensure_component_dir_name_is_correct!
(
component
,
install_dir
)
...
...
@@ -472,22 +472,22 @@ module TestEnv
return
if
File
.
exist?
(
install_dir
)
&&
ci?
if
component_needs_update?
(
install_dir
,
version
)
puts
"
\n
==> Setting up
#{
component
}
..."
# Cleanup the component entirely to ensure we start fresh
FileUtils
.
rm_rf
(
install_dir
)
unless
system
(
'rake'
,
task
)
raise
ComponentFailedToInstallError
end
end
yield
if
block_given?
yield
if
block_given?
puts
"
#{
component
}
set up in
#{
Time
.
now
-
start
}
seconds...
\n
"
end
rescue
ComponentFailedToInstallError
puts
"
\n
#{
component
}
failed to install, cleaning up
#{
install_dir
}
!
\n
"
FileUtils
.
rm_rf
(
install_dir
)
exit
1
ensure
puts
"
#{
component
}
set up in
#{
Time
.
now
-
start
}
seconds...
\n
"
end
def
ci?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment