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
008a6a6c
Commit
008a6a6c
authored
Mar 14, 2018
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Route path lookups through legacy_disk_path
parent
b3daf108
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
138 additions
and
85 deletions
+138
-85
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+2
-7
config/initializers/6_validations.rb
config/initializers/6_validations.rb
+3
-3
db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb
...rate/20161124141322_migrate_process_commit_worker_jobs.rb
+1
-1
db/migrate/20161220141214_remove_dot_git_from_group_names.rb
db/migrate/20161220141214_remove_dot_git_from_group_names.rb
+1
-1
db/migrate/20161226122833_remove_dot_git_from_usernames.rb
db/migrate/20161226122833_remove_dot_git_from_usernames.rb
+2
-2
lib/backup/repository.rb
lib/backup/repository.rb
+2
-2
lib/gitlab/database/rename_reserved_paths_migration/v1/migration_classes.rb
...e/rename_reserved_paths_migration/v1/migration_classes.rb
+1
-1
lib/gitlab/git/gitlab_projects.rb
lib/gitlab/git/gitlab_projects.rb
+1
-1
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+1
-1
lib/gitlab/git/storage/checker.rb
lib/gitlab/git/storage/checker.rb
+1
-1
lib/gitlab/git/storage/circuit_breaker.rb
lib/gitlab/git/storage/circuit_breaker.rb
+1
-1
lib/gitlab/gitaly_client/storage_settings.rb
lib/gitlab/gitaly_client/storage_settings.rb
+35
-0
lib/gitlab/health_checks/fs_shards_check.rb
lib/gitlab/health_checks/fs_shards_check.rb
+1
-1
lib/gitlab/repo_path.rb
lib/gitlab/repo_path.rb
+2
-2
lib/gitlab/setup_helper.rb
lib/gitlab/setup_helper.rb
+1
-1
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+3
-3
lib/gitlab/task_helpers.rb
lib/gitlab/task_helpers.rb
+2
-2
lib/system_check/orphans/namespace_check.rb
lib/system_check/orphans/namespace_check.rb
+2
-2
lib/system_check/orphans/repository_check.rb
lib/system_check/orphans/repository_check.rb
+4
-2
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+4
-4
lib/tasks/gitlab/cleanup.rake
lib/tasks/gitlab/cleanup.rake
+2
-2
lib/tasks/gitlab/info.rake
lib/tasks/gitlab/info.rake
+1
-1
spec/initializers/6_validations_spec.rb
spec/initializers/6_validations_spec.rb
+7
-7
spec/initializers/settings_spec.rb
spec/initializers/settings_spec.rb
+1
-1
spec/lib/backup/repository_spec.rb
spec/lib/backup/repository_spec.rb
+1
-1
spec/lib/gitlab/bare_repository_import/repository_spec.rb
spec/lib/gitlab/bare_repository_import/repository_spec.rb
+1
-1
spec/lib/gitlab/health_checks/fs_shards_check_spec.rb
spec/lib/gitlab/health_checks/fs_shards_check_spec.rb
+3
-3
spec/lib/gitlab/repo_path_spec.rb
spec/lib/gitlab/repo_path_spec.rb
+2
-2
spec/lib/gitlab/shell_spec.rb
spec/lib/gitlab/shell_spec.rb
+2
-2
spec/migrations/remove_dot_git_from_usernames_spec.rb
spec/migrations/remove_dot_git_from_usernames_spec.rb
+3
-1
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-2
spec/services/projects/create_service_spec.rb
spec/services/projects/create_service_spec.rb
+1
-1
spec/services/projects/fork_service_spec.rb
spec/services/projects/fork_service_spec.rb
+1
-1
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+1
-1
spec/services/projects/update_service_spec.rb
spec/services/projects/update_service_spec.rb
+1
-1
spec/support/stored_repositories.rb
spec/support/stored_repositories.rb
+1
-1
spec/support/stub_configuration.rb
spec/support/stub_configuration.rb
+6
-2
spec/support/test_env.rb
spec/support/test_env.rb
+1
-1
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+12
-3
spec/tasks/gitlab/cleanup_rake_spec.rb
spec/tasks/gitlab/cleanup_rake_spec.rb
+5
-2
spec/tasks/gitlab/git_rake_spec.rb
spec/tasks/gitlab/git_rake_spec.rb
+5
-2
spec/tasks/gitlab/gitaly_rake_spec.rb
spec/tasks/gitlab/gitaly_rake_spec.rb
+5
-5
spec/tasks/gitlab/shell_rake_spec.rb
spec/tasks/gitlab/shell_rake_spec.rb
+1
-1
No files found.
app/helpers/application_settings_helper.rb
View file @
008a6a6c
...
...
@@ -96,7 +96,7 @@ module ApplicationSettingsHelper
def
repository_storages_options_for_select
(
selected
)
options
=
Gitlab
.
config
.
repositories
.
storages
.
map
do
|
name
,
storage
|
[
"
#{
name
}
-
#{
storage
[
'path'
]
}
"
,
name
]
[
"
#{
name
}
-
#{
storage
.
legacy_disk_path
}
"
,
name
]
end
options_for_select
(
options
,
selected
)
...
...
app/models/project.rb
View file @
008a6a6c
...
...
@@ -498,7 +498,7 @@ class Project < ActiveRecord::Base
end
def
repository_storage_path
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
try
(
:[]
,
'path'
)
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
&
.
legacy_disk_path
end
def
team
...
...
config/initializers/1_settings.rb
View file @
008a6a6c
...
...
@@ -467,12 +467,7 @@ unless Settings.repositories.storages['default']
end
Settings
.
repositories
.
storages
.
each
do
|
key
,
storage
|
storage
=
Settingslogic
.
new
(
storage
)
# Expand relative paths
storage
[
'path'
]
=
Settings
.
absolute
(
storage
[
'path'
])
Settings
.
repositories
.
storages
[
key
]
=
storage
Settings
.
repositories
.
storages
[
key
]
=
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
storage
)
end
#
...
...
@@ -486,7 +481,7 @@ repositories_storages = Settings.repositories.storages.values
repository_downloads_path
=
Settings
.
gitlab
[
'repository_downloads_path'
].
to_s
.
gsub
(
%r{/$}
,
''
)
repository_downloads_full_path
=
File
.
expand_path
(
repository_downloads_path
,
Settings
.
gitlab
[
'user_home'
])
if
repository_downloads_path
.
blank?
||
repositories_storages
.
any?
{
|
rs
|
[
repository_downloads_path
,
repository_downloads_full_path
].
include?
(
rs
[
'path'
]
.
gsub
(
%r{/$}
,
''
))
}
if
repository_downloads_path
.
blank?
||
repositories_storages
.
any?
{
|
rs
|
[
repository_downloads_path
,
repository_downloads_full_path
].
include?
(
rs
.
legacy_disk_path
.
gsub
(
%r{/$}
,
''
))
}
Settings
.
gitlab
[
'repository_downloads_path'
]
=
File
.
join
(
Settings
.
shared
[
'path'
],
'cache/archive'
)
end
...
...
config/initializers/6_validations.rb
View file @
008a6a6c
...
...
@@ -5,7 +5,7 @@ end
def
find_parent_path
(
name
,
path
)
parent
=
Pathname
.
new
(
path
).
realpath
.
parent
Gitlab
.
config
.
repositories
.
storages
.
detect
do
|
n
,
rs
|
name
!=
n
&&
Pathname
.
new
(
rs
[
'path'
]
).
realpath
==
parent
name
!=
n
&&
Pathname
.
new
(
rs
.
legacy_disk_path
).
realpath
==
parent
end
rescue
Errno
::
EIO
,
Errno
::
ENOENT
=>
e
warning
=
"WARNING: couldn't verify
#{
path
}
(
#{
name
}
). "
\
...
...
@@ -33,7 +33,7 @@ def validate_storages_config
"If you're using the Gitlab Development Kit, you can update your configuration running `gdk reconfigure`.
\n
"
end
if
!
repository_storage
.
is_a?
(
Hash
)
||
repository_storage
[
'path'
]
.
nil?
if
!
repository_storage
.
is_a?
(
Gitlab
::
GitalyClient
::
StorageSettings
)
||
repository_storage
.
legacy_disk_path
.
nil?
storage_validation_error
(
"
#{
name
}
is not a valid storage, because it has no `path` key. Refer to gitlab.yml.example for an updated example"
)
end
...
...
@@ -50,7 +50,7 @@ end
def
validate_storages_paths
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
parent_name
,
_parent_path
=
find_parent_path
(
name
,
repository_storage
[
'path'
]
)
parent_name
,
_parent_path
=
find_parent_path
(
name
,
repository_storage
.
legacy_disk_path
)
if
parent_name
storage_validation_error
(
"
#{
name
}
is a nested path of
#{
parent_name
}
. Nested paths are not supported for repository storages"
)
end
...
...
db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb
View file @
008a6a6c
...
...
@@ -12,7 +12,7 @@ class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration
end
def
repository_storage_path
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
[
'path'
]
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
legacy_disk_path
end
def
repository_path
...
...
db/migrate/20161220141214_remove_dot_git_from_group_names.rb
View file @
008a6a6c
...
...
@@ -60,7 +60,7 @@ class RemoveDotGitFromGroupNames < ActiveRecord::Migration
def
move_namespace
(
group_id
,
path_was
,
path
)
repository_storage_paths
=
select_all
(
"SELECT distinct(repository_storage) FROM projects WHERE namespace_id =
#{
group_id
}
"
).
map
do
|
row
|
Gitlab
.
config
.
repositories
.
storages
[
row
[
'repository_storage'
]]
[
'path'
]
Gitlab
.
config
.
repositories
.
storages
[
row
[
'repository_storage'
]]
.
legacy_disk_path
end
.
compact
# Move the namespace directory in all storages paths used by member projects
...
...
db/migrate/20161226122833_remove_dot_git_from_usernames.rb
View file @
008a6a6c
...
...
@@ -71,7 +71,7 @@ class RemoveDotGitFromUsernames < ActiveRecord::Migration
route_exists
=
route_exists?
(
path
)
Gitlab
.
config
.
repositories
.
storages
.
each_value
do
|
storage
|
if
route_exists
||
path_exists?
(
path
,
storage
[
'path'
]
)
if
route_exists
||
path_exists?
(
path
,
storage
.
legacy_disk_path
)
counter
+=
1
path
=
"
#{
base
}#{
counter
}
"
...
...
@@ -84,7 +84,7 @@ class RemoveDotGitFromUsernames < ActiveRecord::Migration
def
move_namespace
(
namespace_id
,
path_was
,
path
)
repository_storage_paths
=
select_all
(
"SELECT distinct(repository_storage) FROM projects WHERE namespace_id =
#{
namespace_id
}
"
).
map
do
|
row
|
Gitlab
.
config
.
repositories
.
storages
[
row
[
'repository_storage'
]]
[
'path'
]
Gitlab
.
config
.
repositories
.
storages
[
row
[
'repository_storage'
]]
.
legacy_disk_path
end
.
compact
# Move the namespace directory in all storages paths used by member projects
...
...
lib/backup/repository.rb
View file @
008a6a6c
...
...
@@ -65,7 +65,7 @@ module Backup
def
restore
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
path
=
repository_storage
[
'path'
]
path
=
repository_storage
.
legacy_disk_path
next
unless
File
.
exist?
(
path
)
# Move repos dir to 'repositories.old' dir
...
...
@@ -200,7 +200,7 @@ module Backup
end
def
repository_storage_paths_args
Gitlab
.
config
.
repositories
.
storages
.
values
.
map
{
|
rs
|
rs
[
'path'
]
}
Gitlab
.
config
.
repositories
.
storages
.
values
.
map
{
|
rs
|
rs
.
legacy_disk_path
}
end
def
progress
...
...
lib/gitlab/database/rename_reserved_paths_migration/v1/migration_classes.rb
View file @
008a6a6c
...
...
@@ -74,7 +74,7 @@ module Gitlab
}.
freeze
def
repository_storage_path
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
[
'path'
]
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
legacy_disk_path
end
# Overridden to have the correct `source_type` for the `route` relation
...
...
lib/gitlab/git/gitlab_projects.rb
View file @
008a6a6c
...
...
@@ -212,7 +212,7 @@ module Gitlab
end
def
shard_name_from_shard_path
(
shard_path
)
Gitlab
.
config
.
repositories
.
storages
.
find
{
|
_
,
info
|
info
[
'path'
]
==
shard_path
}
&
.
first
||
Gitlab
.
config
.
repositories
.
storages
.
find
{
|
_
,
info
|
info
.
legacy_disk_path
==
shard_path
}
&
.
first
||
raise
(
ShardNameNotFoundError
,
"no shard found for path '
#{
shard_path
}
'"
)
end
...
...
lib/gitlab/git/repository.rb
View file @
008a6a6c
...
...
@@ -93,7 +93,7 @@ module Gitlab
@relative_path
=
relative_path
@gl_repository
=
gl_repository
storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
@storage
]
[
'path'
]
storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
@storage
]
.
legacy_disk_path
@gitlab_projects
=
Gitlab
::
Git
::
GitlabProjects
.
new
(
storage_path
,
relative_path
,
...
...
lib/gitlab/git/storage/checker.rb
View file @
008a6a6c
...
...
@@ -35,7 +35,7 @@ module Gitlab
def
initialize
(
storage
,
logger
=
Rails
.
logger
)
@storage
=
storage
config
=
Gitlab
.
config
.
repositories
.
storages
[
@storage
]
@storage_path
=
config
[
'path'
]
@storage_path
=
config
.
legacy_disk_path
@logger
=
logger
@hostname
=
Gitlab
::
Environment
.
hostname
...
...
lib/gitlab/git/storage/circuit_breaker.rb
View file @
008a6a6c
...
...
@@ -25,7 +25,7 @@ module Gitlab
if
!
config
.
present?
NullCircuitBreaker
.
new
(
storage
,
hostname
,
error:
Misconfiguration
.
new
(
"Storage '
#{
storage
}
' is not configured"
))
elsif
!
config
[
'path'
]
.
present?
elsif
!
config
.
legacy_disk_path
.
present?
NullCircuitBreaker
.
new
(
storage
,
hostname
,
error:
Misconfiguration
.
new
(
"Path for storage '
#{
storage
}
' is not configured"
))
else
new
(
storage
,
hostname
)
...
...
lib/gitlab/gitaly_client/storage_settings.rb
0 → 100644
View file @
008a6a6c
module
Gitlab
module
GitalyClient
# This is a chokepoint that is meant to help us stop remove all places
# where production code (app, config, db, lib) touches Git repositories
# directly.
class
StorageSettings
DirectPathAccessError
=
Class
.
new
(
StandardError
)
# This class will give easily recognizable NoMethodErrors
Deprecated
=
Class
.
new
attr_reader
:legacy_disk_path
def
initialize
(
storage
)
raise
"expected a Hash, got a
#{
storage
.
class
.
name
}
"
unless
storage
.
is_a?
(
Hash
)
# Support a nil 'path' field because some of the circuit breaker tests use it.
@legacy_disk_path
=
File
.
expand_path
(
storage
[
'path'
],
Rails
.
root
)
if
storage
[
'path'
]
storage
[
'path'
]
=
Deprecated
@hash
=
storage
end
def
gitaly_address
@hash
.
fetch
(
:gitaly_address
)
end
private
def
method_missing
(
m
,
*
args
,
&
block
)
@hash
.
public_send
(
m
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
end
end
end
end
lib/gitlab/health_checks/fs_shards_check.rb
View file @
008a6a6c
...
...
@@ -77,7 +77,7 @@ module Gitlab
end
def
storage_path
(
storage_name
)
storages_paths
&
.
dig
(
storage_name
,
'path'
)
storages_paths
[
storage_name
]
&
.
legacy_disk_path
end
# All below test methods use shell commands to perform actions on storage volumes.
...
...
lib/gitlab/repo_path.rb
View file @
008a6a6c
...
...
@@ -21,11 +21,11 @@ module Gitlab
result
=
repo_path
storage
=
Gitlab
.
config
.
repositories
.
storages
.
values
.
find
do
|
params
|
repo_path
.
start_with?
(
params
[
'path'
]
)
repo_path
.
start_with?
(
params
.
legacy_disk_path
)
end
if
storage
result
=
result
.
sub
(
storage
[
'path'
]
,
''
)
result
=
result
.
sub
(
storage
.
legacy_disk_path
,
''
)
elsif
fail_on_not_found
raise
NotFoundError
.
new
(
"No known storage path matches
#{
repo_path
.
inspect
}
"
)
end
...
...
lib/gitlab/setup_helper.rb
View file @
008a6a6c
...
...
@@ -24,7 +24,7 @@ module Gitlab
address
=
val
[
'gitaly_address'
]
end
storages
<<
{
name:
key
,
path:
val
[
'path'
]
}
storages
<<
{
name:
key
,
path:
val
.
legacy_disk_path
}
end
if
Rails
.
env
.
test?
...
...
lib/gitlab/shell.rb
View file @
008a6a6c
...
...
@@ -81,7 +81,7 @@ module Gitlab
repository
.
gitaly_repository_client
.
create_repository
true
else
repo_path
=
File
.
join
(
Gitlab
.
config
.
repositories
.
storages
[
storage
]
[
'path'
]
,
relative_path
)
repo_path
=
File
.
join
(
Gitlab
.
config
.
repositories
.
storages
[
storage
]
.
legacy_disk_path
,
relative_path
)
Gitlab
::
Git
::
Repository
.
create
(
repo_path
,
bare:
true
,
symlink_hooks_to:
gitlab_shell_hooks_path
)
end
end
...
...
@@ -130,7 +130,7 @@ module Gitlab
if
is_enabled
repository
.
gitaly_repository_client
.
fetch_remote
(
remote
,
ssh_auth:
ssh_auth
,
forced:
forced
,
no_tags:
no_tags
,
timeout:
git_timeout
,
prune:
prune
)
else
storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
repository
.
storage
]
[
"path"
]
storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
repository
.
storage
]
.
legacy_disk_path
local_fetch_remote
(
storage_path
,
repository
.
relative_path
,
remote
,
ssh_auth:
ssh_auth
,
forced:
forced
,
no_tags:
no_tags
,
prune:
prune
)
end
end
...
...
@@ -477,7 +477,7 @@ module Gitlab
def
gitaly_namespace_client
(
storage_path
)
storage
,
_value
=
Gitlab
.
config
.
repositories
.
storages
.
find
do
|
storage
,
value
|
value
[
'path'
]
==
storage_path
value
.
legacy_disk_path
==
storage_path
end
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
)
...
...
lib/gitlab/task_helpers.rb
View file @
008a6a6c
...
...
@@ -129,7 +129,7 @@ module Gitlab
def
all_repos
Gitlab
.
config
.
repositories
.
storages
.
each_value
do
|
repository_storage
|
IO
.
popen
(
%W(find
#{
repository_storage
[
'path'
]
}
-mindepth 2 -type d -name *.git)
)
do
|
find
|
IO
.
popen
(
%W(find
#{
repository_storage
.
legacy_disk_path
}
-mindepth 2 -type d -name *.git)
)
do
|
find
|
find
.
each_line
do
|
path
|
yield
path
.
chomp
end
...
...
@@ -138,7 +138,7 @@ module Gitlab
end
def
repository_storage_paths_args
Gitlab
.
config
.
repositories
.
storages
.
values
.
map
{
|
rs
|
rs
[
'path'
]
}
Gitlab
.
config
.
repositories
.
storages
.
values
.
map
{
|
rs
|
rs
.
legacy_disk_path
}
end
def
user_home
...
...
lib/system_check/orphans/namespace_check.rb
View file @
008a6a6c
...
...
@@ -6,8 +6,8 @@ module SystemCheck
def
multi_check
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
storage_name
,
repository_storage
|
$stdout
.
puts
$stdout
.
puts
"* Storage:
#{
storage_name
}
(
#{
repository_storage
[
'path'
]
}
)"
.
color
(
:yellow
)
toplevel_namespace_dirs
=
disk_namespaces
(
repository_storage
[
'path'
]
)
$stdout
.
puts
"* Storage:
#{
storage_name
}
(
#{
repository_storage
.
legacy_disk_path
}
)"
.
color
(
:yellow
)
toplevel_namespace_dirs
=
disk_namespaces
(
repository_storage
.
legacy_disk_path
)
orphans
=
(
toplevel_namespace_dirs
-
existing_namespaces
)
print_orphans
(
orphans
,
storage_name
)
...
...
lib/system_check/orphans/repository_check.rb
View file @
008a6a6c
...
...
@@ -6,10 +6,12 @@ module SystemCheck
def
multi_check
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
storage_name
,
repository_storage
|
storage_path
=
repository_storage
.
legacy_disk_path
$stdout
.
puts
$stdout
.
puts
"* Storage:
#{
storage_name
}
(
#{
repository_storage
[
'path'
]
}
)"
.
color
(
:yellow
)
$stdout
.
puts
"* Storage:
#{
storage_name
}
(
#{
storage_path
}
)"
.
color
(
:yellow
)
repositories
=
disk_repositories
(
repository_storage
[
'path'
]
)
repositories
=
disk_repositories
(
storage_path
)
orphans
=
(
repositories
-
fetch_repositories
(
storage_name
))
print_orphans
(
orphans
,
storage_name
)
...
...
lib/tasks/gitlab/check.rake
View file @
008a6a6c
...
...
@@ -61,7 +61,7 @@ namespace :gitlab do
puts
"Repo base directory exists?"
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
repo_base_path
=
repository_storage
[
'path'
]
repo_base_path
=
repository_storage
.
legacy_disk_path
print
"
#{
name
}
... "
if
File
.
exist?
(
repo_base_path
)
...
...
@@ -86,7 +86,7 @@ namespace :gitlab do
puts
"Repo storage directories are symlinks?"
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
repo_base_path
=
repository_storage
[
'path'
]
repo_base_path
=
repository_storage
.
legacy_disk_path
print
"
#{
name
}
... "
unless
File
.
exist?
(
repo_base_path
)
...
...
@@ -110,7 +110,7 @@ namespace :gitlab do
puts
"Repo paths access is drwxrws---?"
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
repo_base_path
=
repository_storage
[
'path'
]
repo_base_path
=
repository_storage
.
legacy_disk_path
print
"
#{
name
}
... "
unless
File
.
exist?
(
repo_base_path
)
...
...
@@ -140,7 +140,7 @@ namespace :gitlab do
puts
"Repo paths owned by
#{
gitlab_shell_ssh_user
}
:root, or
#{
gitlab_shell_ssh_user
}
:
#{
Gitlab
.
config
.
gitlab_shell
.
owner_group
}
?"
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
repo_base_path
=
repository_storage
[
'path'
]
repo_base_path
=
repository_storage
.
legacy_disk_path
print
"
#{
name
}
... "
unless
File
.
exist?
(
repo_base_path
)
...
...
lib/tasks/gitlab/cleanup.rake
View file @
008a6a6c
...
...
@@ -12,7 +12,7 @@ namespace :gitlab do
namespaces
=
Namespace
.
pluck
(
:path
)
namespaces
<<
HASHED_REPOSITORY_NAME
# add so that it will be ignored
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
git_base_path
=
repository_storage
[
'path'
]
git_base_path
=
repository_storage
.
legacy_disk_path
all_dirs
=
Dir
.
glob
(
git_base_path
+
'/*'
)
puts
git_base_path
.
color
(
:yellow
)
...
...
@@ -54,7 +54,7 @@ namespace :gitlab do
move_suffix
=
"+orphaned+
#{
Time
.
now
.
to_i
}
"
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
repo_root
=
repository_storage
[
'path'
]
repo_root
=
repository_storage
.
legacy_disk_path
# Look for global repos (legacy, depth 1) and normal repos (depth 2)
IO
.
popen
(
%W(find
#{
repo_root
}
-mindepth 1 -maxdepth 2 -name *.git)
)
do
|
find
|
find
.
each_line
do
|
path
|
...
...
lib/tasks/gitlab/info.rake
View file @
008a6a6c
...
...
@@ -68,7 +68,7 @@ namespace :gitlab do
puts
"Version:
\t
#{
gitlab_shell_version
||
"unknown"
.
color
(
:red
)
}
"
puts
"Repository storage paths:"
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
puts
"-
#{
name
}
:
\t
#{
repository_storage
[
'path'
]
}
"
puts
"-
#{
name
}
:
\t
#{
repository_storage
.
legacy_disk_path
}
"
end
puts
"Hooks:
\t\t
#{
Gitlab
.
config
.
gitlab_shell
.
hooks_path
}
"
puts
"Git:
\t\t
#{
Gitlab
.
config
.
git
.
bin_path
}
"
...
...
spec/initializers/6_validations_spec.rb
View file @
008a6a6c
...
...
@@ -15,7 +15,7 @@ describe '6_validations' do
describe
'validate_storages_config'
do
context
'with correct settings'
do
before
do
mock_storages
(
'foo'
=>
{
'path'
=>
'tmp/tests/paths/a/b/c'
},
'bar'
=>
{
'path'
=>
'tmp/tests/paths/a/b/d'
}
)
mock_storages
(
'foo'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/c'
),
'bar'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/d'
)
)
end
it
'passes through'
do
...
...
@@ -25,7 +25,7 @@ describe '6_validations' do
context
'when one of the settings is incorrect'
do
before
do
mock_storages
(
'foo'
=>
{
'path'
=>
'tmp/tests/paths/a/b/c'
,
'failure_count_threshold'
=>
'not a number'
}
)
mock_storages
(
'foo'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/c'
,
'failure_count_threshold'
=>
'not a number'
)
)
end
it
'throws an error'
do
...
...
@@ -35,7 +35,7 @@ describe '6_validations' do
context
'with invalid storage names'
do
before
do
mock_storages
(
'name with spaces'
=>
{
'path'
=>
'tmp/tests/paths/a/b/c'
}
)
mock_storages
(
'name with spaces'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/c'
)
)
end
it
'throws an error'
do
...
...
@@ -67,7 +67,7 @@ describe '6_validations' do
describe
'validate_storages_paths'
do
context
'with correct settings'
do
before
do
mock_storages
(
'foo'
=>
{
'path'
=>
'tmp/tests/paths/a/b/c'
},
'bar'
=>
{
'path'
=>
'tmp/tests/paths/a/b/d'
}
)
mock_storages
(
'foo'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/c'
),
'bar'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/d'
)
)
end
it
'passes through'
do
...
...
@@ -77,7 +77,7 @@ describe '6_validations' do
context
'with nested storage paths'
do
before
do
mock_storages
(
'foo'
=>
{
'path'
=>
'tmp/tests/paths/a/b/c'
},
'bar'
=>
{
'path'
=>
'tmp/tests/paths/a/b/c/d'
}
)
mock_storages
(
'foo'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/c'
),
'bar'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/c/d'
)
)
end
it
'throws an error'
do
...
...
@@ -87,7 +87,7 @@ describe '6_validations' do
context
'with similar but un-nested storage paths'
do
before
do
mock_storages
(
'foo'
=>
{
'path'
=>
'tmp/tests/paths/a/b/c'
},
'bar'
=>
{
'path'
=>
'tmp/tests/paths/a/b/c2'
}
)
mock_storages
(
'foo'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/c'
),
'bar'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/paths/a/b/c2'
)
)
end
it
'passes through'
do
...
...
@@ -97,7 +97,7 @@ describe '6_validations' do
describe
'inaccessible storage'
do
before
do
mock_storages
(
'foo'
=>
{
'path'
=>
'tmp/tests/a/path/that/does/not/exist'
}
)
mock_storages
(
'foo'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/a/path/that/does/not/exist'
)
)
end
it
'passes through with a warning'
do
...
...
spec/initializers/settings_spec.rb
View file @
008a6a6c
require
'spec_helper'
require_relative
'../../config/initializers/1_settings'
require_relative
'../../config/initializers/1_settings'
unless
defined?
(
Settings
)
describe
Settings
do
describe
'#ldap'
do
...
...
spec/lib/backup/repository_spec.rb
View file @
008a6a6c
...
...
@@ -33,7 +33,7 @@ describe Backup::Repository do
let
(
:timestamp
)
{
Time
.
utc
(
2017
,
3
,
22
)
}
let
(
:temp_dirs
)
do
Gitlab
.
config
.
repositories
.
storages
.
map
do
|
name
,
storage
|
File
.
join
(
storage
[
'path'
]
,
'..'
,
'repositories.old.'
+
timestamp
.
to_i
.
to_s
)
File
.
join
(
storage
.
legacy_disk_path
,
'..'
,
'repositories.old.'
+
timestamp
.
to_i
.
to_s
)
end
end
...
...
spec/lib/gitlab/bare_repository_import/repository_spec.rb
View file @
008a6a6c
...
...
@@ -54,7 +54,7 @@ describe ::Gitlab::BareRepositoryImport::Repository do
context
'hashed storage'
do
let
(
:gitlab_shell
)
{
Gitlab
::
Shell
.
new
}
let
(
:repository_storage
)
{
'default'
}
let
(
:root_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
[
'path'
]
}
let
(
:root_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
legacy_disk_path
}
let
(
:hash
)
{
'6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b'
}
let
(
:hashed_path
)
{
"@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b"
}
let
(
:repo_path
)
{
File
.
join
(
root_path
,
"
#{
hashed_path
}
.git"
)
}
...
...
spec/lib/gitlab/health_checks/fs_shards_check_spec.rb
View file @
008a6a6c
...
...
@@ -26,7 +26,7 @@ describe Gitlab::HealthChecks::FsShardsCheck do
let
(
:storages_paths
)
do
{
default:
{
path:
tmp_dir
}
default:
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
tmp_dir
)
}.
with_indifferent_access
end
...
...
@@ -56,7 +56,7 @@ describe Gitlab::HealthChecks::FsShardsCheck do
context
'storage points to not existing folder'
do
let
(
:storages_paths
)
do
{
default:
{
path:
'tmp/this/path/doesnt/exist'
}
default:
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/this/path/doesnt/exist'
)
}.
with_indifferent_access
end
...
...
@@ -102,7 +102,7 @@ describe Gitlab::HealthChecks::FsShardsCheck do
context
'storage points to not existing folder'
do
let
(
:storages_paths
)
do
{
default:
{
path:
'tmp/this/path/doesnt/exist'
}
default:
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/this/path/doesnt/exist'
)
}.
with_indifferent_access
end
...
...
spec/lib/gitlab/repo_path_spec.rb
View file @
008a6a6c
...
...
@@ -48,8 +48,8 @@ describe ::Gitlab::RepoPath do
describe
'.strip_storage_path'
do
before
do
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
({
'storage1'
=>
{
'path'
=>
'/foo'
}
,
'storage2'
=>
{
'path'
=>
'/bar'
}
'storage1'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'/foo'
)
,
'storage2'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'/bar'
)
})
end
...
...
spec/lib/gitlab/shell_spec.rb
View file @
008a6a6c
...
...
@@ -405,7 +405,7 @@ describe Gitlab::Shell do
describe
'#add_repository'
do
shared_examples
'#add_repository'
do
let
(
:repository_storage
)
{
'default'
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
[
'path'
]
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
legacy_disk_path
}
let
(
:repo_name
)
{
'project/path'
}
let
(
:created_path
)
{
File
.
join
(
repository_storage_path
,
repo_name
+
'.git'
)
}
...
...
@@ -679,7 +679,7 @@ describe Gitlab::Shell do
describe
'namespace actions'
do
subject
{
described_class
.
new
}
let
(
:storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
.
default
.
path
}
let
(
:storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
.
default
.
legacy_disk_
path
}
describe
'#add_namespace'
do
it
'creates a namespace'
do
...
...
spec/migrations/remove_dot_git_from_usernames_spec.rb
View file @
008a6a6c
...
...
@@ -29,7 +29,9 @@ describe RemoveDotGitFromUsernames do
update_namespace
(
user
,
'test.git'
)
update_namespace
(
user2
,
'test_git'
)
storages
=
{
'default'
=>
'tmp/tests/custom_repositories'
}
default_hash
=
Gitlab
.
config
.
repositories
.
storages
.
default
.
to_h
default_hash
[
'path'
]
=
'tmp/tests/custom_repositories'
storages
=
{
'default'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
default_hash
)
}
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
storages
)
allow
(
migration
).
to
receive
(
:route_exists?
).
with
(
'test_git'
).
and_return
(
true
)
...
...
spec/models/namespace_spec.rb
View file @
008a6a6c
...
...
@@ -281,7 +281,7 @@ describe Namespace do
end
describe
'#rm_dir'
,
'callback'
do
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
.
default
[
'path'
]
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
.
default
.
legacy_disk_path
}
let
(
:path_in_dir
)
{
File
.
join
(
repository_storage_path
,
namespace
.
full_path
)
}
let
(
:deleted_path
)
{
namespace
.
full_path
.
gsub
(
namespace
.
path
,
"
#{
namespace
.
full_path
}
+
#{
namespace
.
id
}
+deleted"
)
}
let
(
:deleted_path_in_dir
)
{
File
.
join
(
repository_storage_path
,
deleted_path
)
}
...
...
spec/models/project_spec.rb
View file @
008a6a6c
...
...
@@ -1101,8 +1101,8 @@ describe Project do
before
do
storages
=
{
'default'
=>
{
'path'
=>
'tmp/tests/repositories'
}
,
'picked'
=>
{
'path'
=>
'tmp/tests/repositories'
}
'default'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/repositories'
)
,
'picked'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'tmp/tests/repositories'
)
}
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
storages
)
end
...
...
spec/services/projects/create_service_spec.rb
View file @
008a6a6c
...
...
@@ -153,7 +153,7 @@ describe Projects::CreateService, '#execute' do
context
'when another repository already exists on disk'
do
let
(
:repository_storage
)
{
'default'
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
[
'path'
]
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
legacy_disk_path
}
let
(
:opts
)
do
{
...
...
spec/services/projects/fork_service_spec.rb
View file @
008a6a6c
...
...
@@ -105,7 +105,7 @@ describe Projects::ForkService do
context
'repository already exists'
do
let
(
:repository_storage
)
{
'default'
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
[
'path'
]
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
legacy_disk_path
}
before
do
gitlab_shell
.
add_repository
(
repository_storage
,
"
#{
@to_user
.
namespace
.
full_path
}
/
#{
@from_project
.
path
}
"
)
...
...
spec/services/projects/transfer_service_spec.rb
View file @
008a6a6c
...
...
@@ -146,7 +146,7 @@ describe Projects::TransferService do
context
'namespace which contains orphan repository with same projects path name'
do
let
(
:repository_storage
)
{
'default'
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
[
'path'
]
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
legacy_disk_path
}
before
do
group
.
add_owner
(
user
)
...
...
spec/services/projects/update_service_spec.rb
View file @
008a6a6c
...
...
@@ -190,7 +190,7 @@ describe Projects::UpdateService do
context
'when renaming a project'
do
let
(
:repository_storage
)
{
'default'
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
[
'path'
]
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
]
.
legacy_disk_path
}
context
'with legacy storage'
do
let
(
:project
)
{
create
(
:project
,
:legacy_storage
,
:repository
,
creator:
user
,
namespace:
user
.
namespace
)
}
...
...
spec/support/stored_repositories.rb
View file @
008a6a6c
...
...
@@ -4,7 +4,7 @@ RSpec.configure do |config|
end
config
.
before
(
:all
,
:broken_storage
)
do
FileUtils
.
rm_rf
Gitlab
.
config
.
repositories
.
storages
.
broken
[
'path'
]
FileUtils
.
rm_rf
Gitlab
.
config
.
repositories
.
storages
.
broken
.
legacy_disk_path
end
config
.
before
(
:each
,
:broken_storage
)
do
...
...
spec/support/stub_configuration.rb
View file @
008a6a6c
...
...
@@ -50,8 +50,12 @@ module StubConfiguration
# Default storage is always required
messages
[
'default'
]
||=
Gitlab
.
config
.
repositories
.
storages
.
default
messages
.
each
do
|
storage_name
,
storage_settings
|
storage_settings
[
'path'
]
=
TestEnv
.
repos_path
unless
storage_settings
.
key?
(
'path'
)
messages
.
each
do
|
storage_name
,
storage_hash
|
if
!
storage_hash
.
key?
(
'path'
)
||
storage_hash
[
'path'
]
==
Gitlab
::
GitalyClient
::
StorageSettings
::
Deprecated
storage_hash
[
'path'
]
=
TestEnv
.
repos_path
end
messages
[
storage_name
]
=
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
storage_hash
.
to_h
)
end
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
Settingslogic
.
new
(
messages
))
...
...
spec/support/test_env.rb
View file @
008a6a6c
...
...
@@ -225,7 +225,7 @@ module TestEnv
end
def
repos_path
Gitlab
.
config
.
repositories
.
storages
.
default
[
'path'
]
Gitlab
.
config
.
repositories
.
storages
.
default
.
legacy_disk_path
end
def
backup_path
...
...
spec/tasks/gitlab/backup_rake_spec.rb
View file @
008a6a6c
...
...
@@ -195,14 +195,23 @@ describe 'gitlab:app namespace rake task' do
end
context
'multiple repository storages'
do
let
(
:gitaly_address
)
{
Gitlab
.
config
.
repositories
.
storages
.
default
.
gitaly_address
}
let
(
:storage_default
)
do
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
@default_storage_hash
.
merge
(
'path'
=>
'tmp/tests/default_storage'
))
end
let
(
:test_second_storage
)
do
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
@default_storage_hash
.
merge
(
'path'
=>
'tmp/tests/custom_storage'
))
end
let
(
:storages
)
do
{
'default'
=>
{
'path'
=>
Settings
.
absolute
(
'tmp/tests/default_storage'
),
'gitaly_address'
=>
gitaly_address
}
,
'test_second_storage'
=>
{
'path'
=>
Settings
.
absolute
(
'tmp/tests/custom_storage'
),
'gitaly_address'
=>
gitaly_address
}
'default'
=>
storage_default
,
'test_second_storage'
=>
test_second_storage
}
end
before
(
:all
)
do
@default_storage_hash
=
Gitlab
.
config
.
repositories
.
storages
.
default
.
to_h
end
before
do
# We only need a backup of the repositories for this test
stub_env
(
'SKIP'
,
'db,uploads,builds,artifacts,lfs,registry'
)
...
...
spec/tasks/gitlab/cleanup_rake_spec.rb
View file @
008a6a6c
...
...
@@ -6,13 +6,16 @@ describe 'gitlab:cleanup rake tasks' do
end
describe
'cleanup'
do
let
(
:gitaly_address
)
{
Gitlab
.
config
.
repositories
.
storages
.
default
.
gitaly_address
}
let
(
:storages
)
do
{
'default'
=>
{
'path'
=>
Settings
.
absolute
(
'tmp/tests/default_storage'
),
'gitaly_address'
=>
gitaly_address
}
'default'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
@default_storage_hash
.
merge
(
'path'
=>
'tmp/tests/default_storage'
))
}
end
before
(
:all
)
do
@default_storage_hash
=
Gitlab
.
config
.
repositories
.
storages
.
default
.
to_h
end
before
do
FileUtils
.
mkdir
(
Settings
.
absolute
(
'tmp/tests/default_storage'
))
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
storages
)
...
...
spec/tasks/gitlab/git_rake_spec.rb
View file @
008a6a6c
require
'rake_helper'
describe
'gitlab:git rake tasks'
do
before
(
:all
)
do
@default_storage_hash
=
Gitlab
.
config
.
repositories
.
storages
.
default
.
to_h
end
before
do
Rake
.
application
.
rake_require
'tasks/gitlab/git'
storages
=
{
'default'
=>
{
'path'
=>
Settings
.
absolute
(
'tmp/tests/default_storage'
)
}
}
storages
=
{
'default'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
@default_storage_hash
.
merge
(
'path'
=>
'tmp/tests/default_storage'
))
}
FileUtils
.
mkdir_p
(
Settings
.
absolute
(
'tmp/tests/default_storage/@hashed/1/2/test.git'
))
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
storages
)
...
...
spec/tasks/gitlab/gitaly_rake_spec.rb
View file @
008a6a6c
...
...
@@ -99,14 +99,14 @@ describe 'gitlab:gitaly namespace rake task' do
describe
'storage_config'
do
it
'prints storage configuration in a TOML format'
do
config
=
{
'default'
=>
{
'default'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'/path/to/default'
,
'gitaly_address'
=>
'unix:/path/to/my.socket'
}
,
'nfs_01'
=>
{
)
,
'nfs_01'
=>
Gitlab
::
GitalyClient
::
StorageSettings
.
new
(
'path'
=>
'/path/to/nfs_01'
,
'gitaly_address'
=>
'unix:/path/to/my.socket'
}
)
}
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
config
)
allow
(
Rails
.
env
).
to
receive
(
:test?
).
and_return
(
false
)
...
...
@@ -134,7 +134,7 @@ describe 'gitlab:gitaly namespace rake task' do
parsed_output
=
TomlRB
.
parse
(
expected_output
)
config
.
each
do
|
name
,
params
|
expect
(
parsed_output
[
'storage'
]).
to
include
({
'name'
=>
name
,
'path'
=>
params
[
'path'
]
})
expect
(
parsed_output
[
'storage'
]).
to
include
({
'name'
=>
name
,
'path'
=>
params
.
legacy_disk_path
})
end
end
end
...
...
spec/tasks/gitlab/shell_rake_spec.rb
View file @
008a6a6c
...
...
@@ -11,7 +11,7 @@ describe 'gitlab:shell rake tasks' do
it
'invokes create_hooks task'
do
expect
(
Rake
::
Task
[
'gitlab:shell:create_hooks'
]).
to
receive
(
:invoke
)
storages
=
Gitlab
.
config
.
repositories
.
storages
.
values
.
map
{
|
rs
|
rs
[
'path'
]
}
storages
=
Gitlab
.
config
.
repositories
.
storages
.
values
.
map
(
&
:legacy_disk_path
)
expect
(
Kernel
).
to
receive
(
:system
).
with
(
'bin/install'
,
*
storages
).
and_call_original
expect
(
Kernel
).
to
receive
(
:system
).
with
(
'bin/compile'
).
and_call_original
...
...
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