BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
23c502b4
Commit
23c502b4
authored
Aug 03, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-gitaly-install' into 'master'
Ensure we run installation Rake tasks in a clean env in TestEnv Closes #35859 See merge request !13249
parents
1018ab05
532ad2e5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
gitaly.rake
lib/tasks/gitlab/gitaly.rake
+1
-1
test_env.rb
spec/support/test_env.rb
+12
-5
gitaly_rake_spec.rb
spec/tasks/gitlab/gitaly_rake_spec.rb
+4
-6
No files found.
lib/tasks/gitlab/gitaly.rake
View file @
23c502b4
...
...
@@ -21,7 +21,7 @@ namespace :gitlab do
create_gitaly_configuration
# In CI we run scripts/gitaly-test-build instead of this command
unless
ENV
[
'CI'
].
present?
Bundler
.
with_original_env
{
run_command!
(
%w[/usr/bin/env -u BUNDLE_GEMFILE]
+
[
command
])
}
Bundler
.
with_original_env
{
run_command!
([
command
])
}
end
end
end
...
...
spec/support/test_env.rb
View file @
23c502b4
...
...
@@ -63,6 +63,8 @@ module TestEnv
# See gitlab.yml.example test section for paths
#
def
init
(
opts
=
{})
Rake
.
application
.
rake_require
'tasks/gitlab/helpers'
Rake
::
Task
.
define_task
:environment
# Disable mailer for spinach tests
disable_mailer
if
opts
[
:mailer
]
==
false
...
...
@@ -122,11 +124,14 @@ module TestEnv
end
def
setup_gitlab_shell
shell_needs_update
=
component_needs_update?
(
Gitlab
.
config
.
gitlab_shell
.
path
,
gitlab_shell_dir
=
File
.
dirname
(
Gitlab
.
config
.
gitlab_shell
.
path
)
gitlab_shell_needs_update
=
component_needs_update?
(
gitlab_shell_dir
,
Gitlab
::
Shell
.
version_required
)
unless
!
shell_needs_update
||
system
(
'rake'
,
'gitlab:shell:install'
)
raise
'Can`t clone gitlab-shell'
Rake
.
application
.
rake_require
'tasks/gitlab/shell'
unless
!
gitlab_shell_needs_update
||
Rake
.
application
.
invoke_task
(
'gitlab:shell:install'
)
FileUtils
.
rm_rf
(
gitlab_shell_dir
)
raise
"Can't install gitlab-shell"
end
end
...
...
@@ -142,8 +147,10 @@ module TestEnv
gitaly_needs_update
=
component_needs_update?
(
gitaly_dir
,
Gitlab
::
GitalyClient
.
expected_server_version
)
unless
!
gitaly_needs_update
||
system
(
'rake'
,
"gitlab:gitaly:install[
#{
gitaly_dir
}
]"
)
raise
"Can't clone gitaly"
Rake
.
application
.
rake_require
'tasks/gitlab/gitaly'
unless
!
gitaly_needs_update
||
Rake
.
application
.
invoke_task
(
"gitlab:gitaly:install[
#{
gitaly_dir
}
]"
)
FileUtils
.
rm_rf
(
gitaly_dir
)
raise
"Can't install gitaly"
end
start_gitaly
(
gitaly_dir
)
...
...
spec/tasks/gitlab/gitaly_rake_spec.rb
View file @
23c502b4
...
...
@@ -41,8 +41,6 @@ describe 'gitlab:gitaly namespace rake task' do
end
describe
'gmake/make'
do
let
(
:command_preamble
)
{
%w[/usr/bin/env -u BUNDLE_GEMFILE]
}
before
(
:all
)
do
@old_env_ci
=
ENV
.
delete
(
'CI'
)
end
...
...
@@ -59,12 +57,12 @@ describe 'gitlab:gitaly namespace rake task' do
context
'gmake is available'
do
before
do
expect_any_instance_of
(
Object
).
to
receive
(
:checkout_or_clone_version
)
allow_any_instance_of
(
Object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
[
'gmake'
]).
and_return
(
true
)
allow_any_instance_of
(
Object
).
to
receive
(
:run_command!
).
with
([
'gmake'
]).
and_return
(
true
)
end
it
'calls gmake in the gitaly directory'
do
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen
).
with
(
%w[which gmake]
).
and_return
([
'/usr/bin/gmake'
,
0
])
expect_any_instance_of
(
Object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
[
'gmake'
]).
and_return
(
true
)
expect_any_instance_of
(
Object
).
to
receive
(
:run_command!
).
with
([
'gmake'
]).
and_return
(
true
)
run_rake_task
(
'gitlab:gitaly:install'
,
clone_path
)
end
...
...
@@ -73,12 +71,12 @@ describe 'gitlab:gitaly namespace rake task' do
context
'gmake is not available'
do
before
do
expect_any_instance_of
(
Object
).
to
receive
(
:checkout_or_clone_version
)
allow_any_instance_of
(
Object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
[
'make'
]).
and_return
(
true
)
allow_any_instance_of
(
Object
).
to
receive
(
:run_command!
).
with
([
'make'
]).
and_return
(
true
)
end
it
'calls make in the gitaly directory'
do
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen
).
with
(
%w[which gmake]
).
and_return
([
''
,
42
])
expect_any_instance_of
(
Object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
[
'make'
]).
and_return
(
true
)
expect_any_instance_of
(
Object
).
to
receive
(
:run_command!
).
with
([
'make'
]).
and_return
(
true
)
run_rake_task
(
'gitlab:gitaly:install'
,
clone_path
)
end
...
...
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