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
1c7c348e
Commit
1c7c348e
authored
Nov 01, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix EE-only exception to the git default user SSH config check
parent
4bcc24e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
lib/system_check/app/git_user_default_ssh_config_check.rb
lib/system_check/app/git_user_default_ssh_config_check.rb
+2
-2
spec/lib/system_check/app/git_user_default_ssh_config_check_spec.rb
...ystem_check/app/git_user_default_ssh_config_check_spec.rb
+7
-2
No files found.
lib/system_check/app/git_user_default_ssh_config_check.rb
View file @
1c7c348e
...
@@ -11,10 +11,10 @@ module SystemCheck
...
@@ -11,10 +11,10 @@ module SystemCheck
]
.
freeze
]
.
freeze
set_name
'Git user has default SSH configuration?'
set_name
'Git user has default SSH configuration?'
set_skip_reason
'skipped (G
itLab read-onl
y, or git user is not present / configured)'
set_skip_reason
'skipped (G
eo uses SSH ke
y, or git user is not present / configured)'
def
skip?
def
skip?
Gitlab
::
Database
.
read_onl
y?
||
!
home_dir
||
!
File
.
directory?
(
home_dir
)
::
Gitlab
::
Geo
.
current_node
&
.
uses_ssh_ke
y?
||
!
home_dir
||
!
File
.
directory?
(
home_dir
)
end
end
def
check?
def
check?
...
...
spec/lib/system_check/app/git_user_default_ssh_config_check_spec.rb
View file @
1c7c348e
require
'spec_helper'
require
'spec_helper'
describe
SystemCheck
::
App
::
GitUserDefaultSSHConfigCheck
do
describe
SystemCheck
::
App
::
GitUserDefaultSSHConfigCheck
do
include
::
EE
::
GeoHelpers
let
(
:username
)
{
'_this_user_will_not_exist_unless_it_is_stubbed'
}
let
(
:username
)
{
'_this_user_will_not_exist_unless_it_is_stubbed'
}
let
(
:base_dir
)
{
Dir
.
mktmpdir
}
let
(
:base_dir
)
{
Dir
.
mktmpdir
}
let
(
:home_dir
)
{
File
.
join
(
base_dir
,
"/var/lib/
#{
username
}
"
)
}
let
(
:home_dir
)
{
File
.
join
(
base_dir
,
"/var/lib/
#{
username
}
"
)
}
...
@@ -40,10 +42,12 @@ describe SystemCheck::App::GitUserDefaultSSHConfigCheck do
...
@@ -40,10 +42,12 @@ describe SystemCheck::App::GitUserDefaultSSHConfigCheck do
it
{
is_expected
.
to
eq
(
expected_result
)
}
it
{
is_expected
.
to
eq
(
expected_result
)
}
end
end
it
'skips G
itLab read-only instances
'
do
it
'skips G
eo secondaries with SSH
'
do
stub_user
stub_user
stub_home_dir
stub_home_dir
allow
(
Gitlab
::
Database
).
to
receive
(
:read_only?
).
and_return
(
true
)
node
=
create
(
:geo_node
,
:ssh
)
stub_current_geo_node
(
node
)
is_expected
.
to
be_truthy
is_expected
.
to
be_truthy
end
end
...
@@ -78,6 +82,7 @@ describe SystemCheck::App::GitUserDefaultSSHConfigCheck do
...
@@ -78,6 +82,7 @@ describe SystemCheck::App::GitUserDefaultSSHConfigCheck do
end
end
def
stub_user
def
stub_user
allow
(
File
).
to
receive
(
:expand_path
).
and_call_original
allow
(
File
).
to
receive
(
:expand_path
).
with
(
"~
#{
username
}
"
).
and_return
(
home_dir
)
allow
(
File
).
to
receive
(
:expand_path
).
with
(
"~
#{
username
}
"
).
and_return
(
home_dir
)
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