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
7ce0a61a
Commit
7ce0a61a
authored
Jul 26, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use `.zero?` instead of `== 0`
parent
895e1b3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
lib/gitlab/health_checks/fs_shards_check.rb
lib/gitlab/health_checks/fs_shards_check.rb
+4
-4
spec/lib/gitlab/health_checks/fs_shards_check_spec.rb
spec/lib/gitlab/health_checks/fs_shards_check_spec.rb
+1
-1
No files found.
lib/gitlab/health_checks/fs_shards_check.rb
View file @
7ce0a61a
...
@@ -81,7 +81,7 @@ module Gitlab
...
@@ -81,7 +81,7 @@ module Gitlab
def
delete_test_file
(
tmp_path
)
def
delete_test_file
(
tmp_path
)
_
,
status
=
exec_with_timeout
(
%W{ rm -f
#{
tmp_path
}
}
)
_
,
status
=
exec_with_timeout
(
%W{ rm -f
#{
tmp_path
}
}
)
status
==
0
status
.
zero?
rescue
Errno
::
ENOENT
rescue
Errno
::
ENOENT
File
.
delete
(
tmp_path
)
rescue
Errno
::
ENOENT
File
.
delete
(
tmp_path
)
rescue
Errno
::
ENOENT
end
end
...
@@ -90,7 +90,7 @@ module Gitlab
...
@@ -90,7 +90,7 @@ module Gitlab
stat_path
=
File
.
join
(
storage_path
(
storage_name
),
'.'
)
stat_path
=
File
.
join
(
storage_path
(
storage_name
),
'.'
)
begin
begin
_
,
status
=
exec_with_timeout
(
%W{ stat
#{
stat_path
}
}
)
_
,
status
=
exec_with_timeout
(
%W{ stat
#{
stat_path
}
}
)
status
==
0
status
.
zero?
rescue
Errno
::
ENOENT
rescue
Errno
::
ENOENT
File
.
exist?
(
stat_path
)
&&
File
::
Stat
.
new
(
stat_path
).
readable?
File
.
exist?
(
stat_path
)
&&
File
::
Stat
.
new
(
stat_path
).
readable?
end
end
...
@@ -100,7 +100,7 @@ module Gitlab
...
@@ -100,7 +100,7 @@ module Gitlab
_
,
status
=
exec_with_timeout
(
%W{ tee
#{
tmp_path
}
}
)
do
|
stdin
|
_
,
status
=
exec_with_timeout
(
%W{ tee
#{
tmp_path
}
}
)
do
|
stdin
|
stdin
.
write
(
RANDOM_STRING
)
stdin
.
write
(
RANDOM_STRING
)
end
end
status
==
0
status
.
zero?
rescue
Errno
::
ENOENT
rescue
Errno
::
ENOENT
written_bytes
=
File
.
write
(
tmp_path
,
RANDOM_STRING
)
rescue
Errno
::
ENOENT
written_bytes
=
File
.
write
(
tmp_path
,
RANDOM_STRING
)
rescue
Errno
::
ENOENT
written_bytes
==
RANDOM_STRING
.
length
written_bytes
==
RANDOM_STRING
.
length
...
@@ -110,7 +110,7 @@ module Gitlab
...
@@ -110,7 +110,7 @@ module Gitlab
_
,
status
=
exec_with_timeout
(
%W{ diff
#{
tmp_path
}
- }
)
do
|
stdin
|
_
,
status
=
exec_with_timeout
(
%W{ diff
#{
tmp_path
}
- }
)
do
|
stdin
|
stdin
.
write
(
RANDOM_STRING
)
stdin
.
write
(
RANDOM_STRING
)
end
end
status
==
0
status
.
zero?
rescue
Errno
::
ENOENT
rescue
Errno
::
ENOENT
file_contents
=
File
.
read
(
tmp_path
)
rescue
Errno
::
ENOENT
file_contents
=
File
.
read
(
tmp_path
)
rescue
Errno
::
ENOENT
file_contents
==
RANDOM_STRING
file_contents
==
RANDOM_STRING
...
...
spec/lib/gitlab/health_checks/fs_shards_check_spec.rb
View file @
7ce0a61a
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
HealthChecks
::
FsShardsCheck
do
describe
Gitlab
::
HealthChecks
::
FsShardsCheck
do
def
command_exists?
(
command
)
def
command_exists?
(
command
)
_
,
status
=
Gitlab
::
Popen
.
popen
(
%W{
#{
command
}
1 echo }
)
_
,
status
=
Gitlab
::
Popen
.
popen
(
%W{
#{
command
}
1 echo }
)
status
==
0
status
.
zero?
rescue
Errno
::
ENOENT
rescue
Errno
::
ENOENT
false
false
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