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
Léo-Paul Géneau
gitlab-ce
Commits
c505a523
Commit
c505a523
authored
Sep 25, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed few gitlab:check tasks that were failing with exception
parent
e2b195b2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
2 deletions
+44
-2
changelogs/unreleased/38280-undefined-run_command-when-running-rake-gitlab-check.yml
...-undefined-run_command-when-running-rake-gitlab-check.yml
+5
-0
lib/system_check/app/git_version_check.rb
lib/system_check/app/git_version_check.rb
+1
-1
lib/system_check/app/ruby_version_check.rb
lib/system_check/app/ruby_version_check.rb
+1
-1
spec/lib/system_check/base_check_spec.rb
spec/lib/system_check/base_check_spec.rb
+17
-0
spec/tasks/gitlab/task_helpers_spec.rb
spec/tasks/gitlab/task_helpers_spec.rb
+20
-0
No files found.
changelogs/unreleased/38280-undefined-run_command-when-running-rake-gitlab-check.yml
0 → 100644
View file @
c505a523
---
title
:
Some checks in `rake gitlab:check` were failling with 'undefined method `run_command`'
merge_request
:
14469
author
:
type
:
fixed
lib/system_check/app/git_version_check.rb
View file @
c505a523
...
@@ -9,7 +9,7 @@ module SystemCheck
...
@@ -9,7 +9,7 @@ module SystemCheck
end
end
def
self
.
current_version
def
self
.
current_version
@current_version
||=
Gitlab
::
VersionInfo
.
parse
(
run_command
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--version)
))
@current_version
||=
Gitlab
::
VersionInfo
.
parse
(
Gitlab
::
TaskHelpers
.
run_command
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--version)
))
end
end
def
check?
def
check?
...
...
lib/system_check/app/ruby_version_check.rb
View file @
c505a523
...
@@ -9,7 +9,7 @@ module SystemCheck
...
@@ -9,7 +9,7 @@ module SystemCheck
end
end
def
self
.
current_version
def
self
.
current_version
@current_version
||=
Gitlab
::
VersionInfo
.
parse
(
run_command
(
%w(ruby --version)
))
@current_version
||=
Gitlab
::
VersionInfo
.
parse
(
Gitlab
::
TaskHelpers
.
run_command
(
%w(ruby --version)
))
end
end
def
check?
def
check?
...
...
spec/lib/system_check/base_check_spec.rb
0 → 100644
View file @
c505a523
require
'spec_helper'
describe
SystemCheck
::
BaseCheck
do
context
'helpers on instance level'
do
it
'responds to SystemCheck::Helpers methods'
do
expect
(
subject
).
to
respond_to
:fix_and_rerun
,
:for_more_information
,
:see_installation_guide_section
,
:finished_checking
,
:start_checking
,
:try_fixing_it
,
:sanitized_message
,
:should_sanitize?
,
:omnibus_gitlab?
,
:sudo_gitlab
end
it
'responds to Gitlab::TaskHelpers methods'
do
expect
(
subject
).
to
respond_to
:ask_to_continue
,
:os_name
,
:prompt
,
:run_and_match
,
:run_command
,
:run_command!
,
:uid_for
,
:gid_for
,
:gitlab_user
,
:gitlab_user?
,
:warn_user_is_not_gitlab
,
:all_repos
,
:repository_storage_paths_args
,
:user_home
,
:checkout_or_clone_version
,
:clone_repo
,
:checkout_version
end
end
end
spec/tasks/gitlab/task_helpers_spec.rb
View file @
c505a523
...
@@ -75,4 +75,24 @@ describe Gitlab::TaskHelpers do
...
@@ -75,4 +75,24 @@ describe Gitlab::TaskHelpers do
subject
.
checkout_version
(
tag
,
clone_path
)
subject
.
checkout_version
(
tag
,
clone_path
)
end
end
end
end
describe
'#run_command'
do
it
'runs command and return the output'
do
expect
(
subject
.
run_command
(
%w(echo it works!)
)).
to
eq
(
"it works!
\n
"
)
end
it
'returns empty string when command doesnt exist'
do
expect
(
subject
.
run_command
(
%w(nonexistentcommand with arguments)
)).
to
eq
(
''
)
end
end
describe
'#run_command!'
do
it
'runs command and return the output'
do
expect
(
subject
.
run_command!
(
%w(echo it works!)
)).
to
eq
(
"it works!
\n
"
)
end
it
'returns and exception when command exit with non zero code'
do
expect
{
subject
.
run_command!
([
'bash'
,
'-c'
,
'exit 1'
])
}.
to
raise_error
Gitlab
::
TaskFailedError
end
end
end
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