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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
fab0c1eb
Commit
fab0c1eb
authored
Aug 10, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use existing BUNDLE_PATH for gitaly in local tests
parent
cfc5f0f5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
lib/tasks/gitlab/gitaly.rake
lib/tasks/gitlab/gitaly.rake
+6
-2
spec/tasks/gitlab/gitaly_rake_spec.rb
spec/tasks/gitlab/gitaly_rake_spec.rb
+16
-5
No files found.
lib/tasks/gitlab/gitaly.rake
View file @
fab0c1eb
...
...
@@ -15,13 +15,17 @@ namespace :gitlab do
checkout_or_clone_version
(
version:
version
,
repo:
args
.
repo
,
target_dir:
args
.
dir
)
_
,
status
=
Gitlab
::
Popen
.
popen
(
%w[which gmake]
)
command
=
status
.
zero?
?
'gmake'
:
'make'
command
=
status
.
zero?
?
[
'gmake'
]
:
[
'make'
]
if
Rails
.
env
.
test?
command
+=
%W[BUNDLE_PATH=
#{
Bundler
.
bundle_path
}
]
end
Dir
.
chdir
(
args
.
dir
)
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 RUBYOPT -u BUNDLE_GEMFILE]
+
[
command
]
)
}
Bundler
.
with_original_env
{
run_command!
(
%w[/usr/bin/env -u RUBYOPT -u BUNDLE_GEMFILE]
+
command
)
}
end
end
end
...
...
spec/tasks/gitlab/gitaly_rake_spec.rb
View file @
fab0c1eb
...
...
@@ -54,17 +54,17 @@ describe 'gitlab:gitaly namespace rake task' do
before
do
FileUtils
.
mkdir_p
(
clone_path
)
expect
(
Dir
).
to
receive
(
:chdir
).
with
(
clone_path
).
and_call_original
allow
(
Bundler
).
to
receive
(
:bundle_path
).
and_return
(
'/fake/bundle_path'
)
end
context
'gmake is available'
do
before
do
expect
(
main_object
).
to
receive
(
:checkout_or_clone_version
)
allow
(
main_object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
[
'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
(
main_object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
[
'gmake'
]).
and_return
(
true
)
expect
(
main_object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
%w[gmake BUNDLE_PATH=/fake/bundle_path
]
).
and_return
(
true
)
run_rake_task
(
'gitlab:gitaly:install'
,
clone_path
)
end
...
...
@@ -73,11 +73,21 @@ describe 'gitlab:gitaly namespace rake task' do
context
'gmake is not available'
do
before
do
expect
(
main_object
).
to
receive
(
:checkout_or_clone_version
)
allow
(
main_object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
[
'make'
]).
and_return
(
true
)
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen
).
with
(
%w[which gmake]
).
and_return
([
''
,
42
]
)
end
it
'calls make in the gitaly directory'
do
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen
).
with
(
%w[which gmake]
).
and_return
([
''
,
42
])
expect
(
main_object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
%w[make BUNDLE_PATH=/fake/bundle_path]
).
and_return
(
true
)
run_rake_task
(
'gitlab:gitaly:install'
,
clone_path
)
end
context
'when Rails.env is not "test"'
do
before
do
allow
(
Rails
.
env
).
to
receive
(
:test?
).
and_return
(
false
)
end
it
'calls make in the gitaly directory without BUNDLE_PATH'
do
expect
(
main_object
).
to
receive
(
:run_command!
).
with
(
command_preamble
+
[
'make'
]).
and_return
(
true
)
run_rake_task
(
'gitlab:gitaly:install'
,
clone_path
)
...
...
@@ -85,6 +95,7 @@ describe 'gitlab:gitaly namespace rake task' do
end
end
end
end
describe
'storage_config'
do
it
'prints storage configuration in a TOML format'
do
...
...
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