Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a89f18bf
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a89f18bf
编写于
7月 18, 2017
作者:
A
Andrew Newdigate
提交者:
Sean McGivern
7月 18, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Renamed Gitaly services
上级
a8aae1be
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
61 addition
and
61 deletion
+61
-61
app/models/commit.rb
app/models/commit.rb
+2
-2
lib/api/internal.rb
lib/api/internal.rb
+1
-1
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+4
-4
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-2
lib/gitlab/gitaly_client/blob_service.rb
lib/gitlab/gitaly_client/blob_service.rb
+2
-2
lib/gitlab/gitaly_client/commit_service.rb
lib/gitlab/gitaly_client/commit_service.rb
+5
-5
lib/gitlab/gitaly_client/notification_service.rb
lib/gitlab/gitaly_client/notification_service.rb
+2
-2
lib/gitlab/gitaly_client/ref_service.rb
lib/gitlab/gitaly_client/ref_service.rb
+6
-6
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+9
-9
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+6
-6
spec/lib/gitlab/gitaly_client/notification_service_spec.rb
spec/lib/gitlab/gitaly_client/notification_service_spec.rb
+2
-2
spec/lib/gitlab/gitaly_client/ref_service_spec.rb
spec/lib/gitlab/gitaly_client/ref_service_spec.rb
+7
-7
spec/lib/gitlab/gitaly_client_spec.rb
spec/lib/gitlab/gitaly_client_spec.rb
+4
-4
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+9
-9
未找到文件。
app/models/commit.rb
浏览文件 @
a89f18bf
...
...
@@ -322,7 +322,7 @@ class Commit
def
raw_diffs
(
*
args
)
if
Gitlab
::
GitalyClient
.
feature_enabled?
(
:commit_raw_diffs
)
Gitlab
::
GitalyClient
::
Commit
.
new
(
project
.
repository
).
diff_from_parent
(
self
,
*
args
)
Gitlab
::
GitalyClient
::
Commit
Service
.
new
(
project
.
repository
).
diff_from_parent
(
self
,
*
args
)
else
raw
.
diffs
(
*
args
)
end
...
...
@@ -331,7 +331,7 @@ class Commit
def
raw_deltas
@deltas
||=
Gitlab
::
GitalyClient
.
migrate
(
:commit_deltas
)
do
|
is_enabled
|
if
is_enabled
Gitlab
::
GitalyClient
::
Commit
.
new
(
project
.
repository
).
commit_deltas
(
self
)
Gitlab
::
GitalyClient
::
Commit
Service
.
new
(
project
.
repository
).
commit_deltas
(
self
)
else
raw
.
deltas
end
...
...
lib/api/internal.rb
浏览文件 @
a89f18bf
...
...
@@ -150,7 +150,7 @@ module API
#
# begin
# repository = wiki? ? project.wiki.repository : project.repository
# Gitlab::GitalyClient::Notification
s
.new(repository.raw_repository).post_receive
# Gitlab::GitalyClient::Notification
Service
.new(repository.raw_repository).post_receive
# rescue GRPC::Unavailable => e
# render_api_error!(e, 500)
# end
...
...
lib/gitlab/git/blob.rb
浏览文件 @
a89f18bf
...
...
@@ -29,7 +29,7 @@ module Gitlab
path
=
path
.
sub
(
/\A\/*/
,
''
)
path
=
'/'
if
path
.
empty?
name
=
File
.
basename
(
path
)
entry
=
Gitlab
::
GitalyClient
::
Commit
.
new
(
repository
).
tree_entry
(
sha
,
path
,
MAX_DATA_DISPLAY_SIZE
)
entry
=
Gitlab
::
GitalyClient
::
Commit
Service
.
new
(
repository
).
tree_entry
(
sha
,
path
,
MAX_DATA_DISPLAY_SIZE
)
return
unless
entry
case
entry
.
type
...
...
@@ -87,10 +87,10 @@ module Gitlab
def
raw
(
repository
,
sha
)
Gitlab
::
GitalyClient
.
migrate
(
:git_blob_raw
)
do
|
is_enabled
|
if
is_enabled
Gitlab
::
GitalyClient
::
Blob
.
new
(
repository
).
get_blob
(
oid:
sha
,
limit:
MAX_DATA_DISPLAY_SIZE
)
Gitlab
::
GitalyClient
::
Blob
Service
.
new
(
repository
).
get_blob
(
oid:
sha
,
limit:
MAX_DATA_DISPLAY_SIZE
)
else
blob
=
repository
.
lookup
(
sha
)
new
(
id:
blob
.
oid
,
size:
blob
.
size
,
...
...
@@ -182,7 +182,7 @@ module Gitlab
Gitlab
::
GitalyClient
.
migrate
(
:git_blob_load_all_data
)
do
|
is_enabled
|
@data
=
begin
if
is_enabled
Gitlab
::
GitalyClient
::
Blob
.
new
(
repository
).
get_blob
(
oid:
id
,
limit:
-
1
).
data
Gitlab
::
GitalyClient
::
Blob
Service
.
new
(
repository
).
get_blob
(
oid:
id
,
limit:
-
1
).
data
else
repository
.
lookup
(
id
).
content
end
...
...
lib/gitlab/git/repository.rb
浏览文件 @
a89f18bf
...
...
@@ -1106,11 +1106,11 @@ module Gitlab
end
def
gitaly_ref_client
@gitaly_ref_client
||=
Gitlab
::
GitalyClient
::
Ref
.
new
(
self
)
@gitaly_ref_client
||=
Gitlab
::
GitalyClient
::
Ref
Service
.
new
(
self
)
end
def
gitaly_commit_client
@gitaly_commit_client
||=
Gitlab
::
GitalyClient
::
Commit
.
new
(
self
)
@gitaly_commit_client
||=
Gitlab
::
GitalyClient
::
Commit
Service
.
new
(
self
)
end
def
gitaly_migrate
(
method
,
&
block
)
...
...
lib/gitlab/gitaly_client/blob.rb
→
lib/gitlab/gitaly_client/blob
_service
.rb
浏览文件 @
a89f18bf
module
Gitlab
module
GitalyClient
class
Blob
class
Blob
Service
def
initialize
(
repository
)
@gitaly_repo
=
repository
.
gitaly_repository
end
def
get_blob
(
oid
:,
limit
:)
request
=
Gitaly
::
GetBlobRequest
.
new
(
repository:
@gitaly_repo
,
...
...
lib/gitlab/gitaly_client/commit.rb
→
lib/gitlab/gitaly_client/commit
_service
.rb
浏览文件 @
a89f18bf
module
Gitlab
module
GitalyClient
class
Commit
class
Commit
Service
# The ID of empty tree.
# See http://stackoverflow.com/a/40884093/1856239 and https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012
EMPTY_TREE_ID
=
'4b825dc642cb6eb9a060e54bf8d69288fbee4904'
.
freeze
...
...
@@ -17,20 +17,20 @@ module Gitlab
child_id:
child_id
)
GitalyClient
.
call
(
@repository
.
storage
,
:commit
,
:commit_is_ancestor
,
request
).
value
GitalyClient
.
call
(
@repository
.
storage
,
:commit
_service
,
:commit_is_ancestor
,
request
).
value
end
def
diff_from_parent
(
commit
,
options
=
{})
request_params
=
commit_diff_request_params
(
commit
,
options
)
request_params
[
:ignore_whitespace_change
]
=
options
.
fetch
(
:ignore_whitespace_change
,
false
)
request
=
Gitaly
::
CommitDiffRequest
.
new
(
request_params
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:diff
,
:commit_diff
,
request
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:diff
_service
,
:commit_diff
,
request
)
Gitlab
::
Git
::
DiffCollection
.
new
(
GitalyClient
::
DiffStitcher
.
new
(
response
),
options
)
end
def
commit_deltas
(
commit
)
request
=
Gitaly
::
CommitDeltaRequest
.
new
(
commit_diff_request_params
(
commit
))
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:diff
,
:commit_delta
,
request
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:diff
_service
,
:commit_delta
,
request
)
response
.
flat_map
do
|
msg
|
msg
.
deltas
.
map
{
|
d
|
Gitlab
::
Git
::
Diff
.
new
(
d
)
}
end
...
...
@@ -44,7 +44,7 @@ module Gitlab
limit:
limit
.
to_i
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:commit
,
:tree_entry
,
request
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:commit
_service
,
:tree_entry
,
request
)
entry
=
response
.
first
return
unless
entry
.
oid
.
present?
...
...
lib/gitlab/gitaly_client/notification
s
.rb
→
lib/gitlab/gitaly_client/notification
_service
.rb
浏览文件 @
a89f18bf
module
Gitlab
module
GitalyClient
class
Notification
s
class
Notification
Service
# 'repository' is a Gitlab::Git::Repository
def
initialize
(
repository
)
@gitaly_repo
=
repository
.
gitaly_repository
...
...
@@ -10,7 +10,7 @@ module Gitlab
def
post_receive
GitalyClient
.
call
(
@storage
,
:notification
s
,
:notification
_service
,
:post_receive
,
Gitaly
::
PostReceiveRequest
.
new
(
repository:
@gitaly_repo
)
)
...
...
lib/gitlab/gitaly_client/ref.rb
→
lib/gitlab/gitaly_client/ref
_service
.rb
浏览文件 @
a89f18bf
module
Gitlab
module
GitalyClient
class
Ref
class
Ref
Service
include
Gitlab
::
EncodingHelper
# 'repository' is a Gitlab::Git::Repository
...
...
@@ -12,19 +12,19 @@ module Gitlab
def
default_branch_name
request
=
Gitaly
::
FindDefaultBranchNameRequest
.
new
(
repository:
@gitaly_repo
)
response
=
GitalyClient
.
call
(
@storage
,
:ref
,
:find_default_branch_name
,
request
)
response
=
GitalyClient
.
call
(
@storage
,
:ref
_service
,
:find_default_branch_name
,
request
)
Gitlab
::
Git
.
branch_name
(
response
.
name
)
end
def
branch_names
request
=
Gitaly
::
FindAllBranchNamesRequest
.
new
(
repository:
@gitaly_repo
)
response
=
GitalyClient
.
call
(
@storage
,
:ref
,
:find_all_branch_names
,
request
)
response
=
GitalyClient
.
call
(
@storage
,
:ref
_service
,
:find_all_branch_names
,
request
)
consume_refs_response
(
response
)
{
|
name
|
Gitlab
::
Git
.
branch_name
(
name
)
}
end
def
tag_names
request
=
Gitaly
::
FindAllTagNamesRequest
.
new
(
repository:
@gitaly_repo
)
response
=
GitalyClient
.
call
(
@storage
,
:ref
,
:find_all_tag_names
,
request
)
response
=
GitalyClient
.
call
(
@storage
,
:ref
_service
,
:find_all_tag_names
,
request
)
consume_refs_response
(
response
)
{
|
name
|
Gitlab
::
Git
.
tag_name
(
name
)
}
end
...
...
@@ -34,7 +34,7 @@ module Gitlab
commit_id:
commit_id
,
prefix:
ref_prefix
)
encode!
(
GitalyClient
.
call
(
@storage
,
:ref
,
:find_ref_name
,
request
).
name
.
dup
)
encode!
(
GitalyClient
.
call
(
@storage
,
:ref
_service
,
:find_ref_name
,
request
).
name
.
dup
)
end
def
count_tag_names
...
...
@@ -48,7 +48,7 @@ module Gitlab
def
local_branches
(
sort_by:
nil
)
request
=
Gitaly
::
FindLocalBranchesRequest
.
new
(
repository:
@gitaly_repo
)
request
.
sort_by
=
sort_by_param
(
sort_by
)
if
sort_by
response
=
GitalyClient
.
call
(
@storage
,
:ref
,
:find_local_branches
,
request
)
response
=
GitalyClient
.
call
(
@storage
,
:ref
_service
,
:find_local_branches
,
request
)
consume_branches_response
(
response
)
end
...
...
spec/lib/gitlab/git/repository_spec.rb
浏览文件 @
a89f18bf
...
...
@@ -45,11 +45,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
it
'gets the branch name from GitalyClient'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
Ref
).
to
receive
(
:default_branch_name
)
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
Ref
Service
).
to
receive
(
:default_branch_name
)
repository
.
root_ref
end
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Ref
,
:default_branch_name
do
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Ref
Service
,
:default_branch_name
do
subject
{
repository
.
root_ref
}
end
end
...
...
@@ -132,11 +132,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
it
{
is_expected
.
not_to
include
(
"branch-from-space"
)
}
it
'gets the branch names from GitalyClient'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
Ref
).
to
receive
(
:branch_names
)
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
Ref
Service
).
to
receive
(
:branch_names
)
subject
end
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Ref
,
:branch_names
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Ref
Service
,
:branch_names
end
describe
'#tag_names'
do
...
...
@@ -160,11 +160,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
it
{
is_expected
.
not_to
include
(
"v5.0.0"
)
}
it
'gets the tag names from GitalyClient'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
Ref
).
to
receive
(
:tag_names
)
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
Ref
Service
).
to
receive
(
:tag_names
)
subject
end
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Ref
,
:tag_names
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Ref
Service
,
:tag_names
end
shared_examples
'archive check'
do
|
extenstion
|
...
...
@@ -368,7 +368,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
context
'when Gitaly commit_count feature is enabled'
do
it_behaves_like
'counting commits'
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Commit
,
:commit_count
do
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Commit
Service
,
:commit_count
do
subject
{
repository
.
commit_count
(
'master'
)
}
end
end
...
...
@@ -1225,12 +1225,12 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
it
'gets the branches from GitalyClient'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
Ref
).
to
receive
(
:local_branches
)
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
Ref
Service
).
to
receive
(
:local_branches
)
.
and_return
([])
@repo
.
local_branches
end
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Ref
,
:local_branches
do
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
Ref
Service
,
:local_branches
do
subject
{
@repo
.
local_branches
}
end
end
...
...
spec/lib/gitlab/gitaly_client/commit_spec.rb
→
spec/lib/gitlab/gitaly_client/commit_s
ervice_s
pec.rb
浏览文件 @
a89f18bf
require
'spec_helper'
describe
Gitlab
::
GitalyClient
::
Commit
do
let
(
:diff_stub
)
{
double
(
'Gitaly::Diff::Stub'
)
}
describe
Gitlab
::
GitalyClient
::
Commit
Service
do
let
(
:diff_stub
)
{
double
(
'Gitaly::Diff
Service
::Stub'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:repository_message
)
{
repository
.
gitaly_repository
}
...
...
@@ -16,7 +16,7 @@ describe Gitlab::GitalyClient::Commit do
right_commit_id:
commit
.
id
)
expect_any_instance_of
(
Gitaly
::
Diff
::
Stub
).
to
receive
(
:commit_diff
).
with
(
request
,
kind_of
(
Hash
))
expect_any_instance_of
(
Gitaly
::
Diff
Service
::
Stub
).
to
receive
(
:commit_diff
).
with
(
request
,
kind_of
(
Hash
))
described_class
.
new
(
repository
).
diff_from_parent
(
commit
)
end
...
...
@@ -31,7 +31,7 @@ describe Gitlab::GitalyClient::Commit do
right_commit_id:
initial_commit
.
id
)
expect_any_instance_of
(
Gitaly
::
Diff
::
Stub
).
to
receive
(
:commit_diff
).
with
(
request
,
kind_of
(
Hash
))
expect_any_instance_of
(
Gitaly
::
Diff
Service
::
Stub
).
to
receive
(
:commit_diff
).
with
(
request
,
kind_of
(
Hash
))
described_class
.
new
(
repository
).
diff_from_parent
(
initial_commit
)
end
...
...
@@ -61,7 +61,7 @@ describe Gitlab::GitalyClient::Commit do
right_commit_id:
commit
.
id
)
expect_any_instance_of
(
Gitaly
::
Diff
::
Stub
).
to
receive
(
:commit_delta
).
with
(
request
,
kind_of
(
Hash
)).
and_return
([])
expect_any_instance_of
(
Gitaly
::
Diff
Service
::
Stub
).
to
receive
(
:commit_delta
).
with
(
request
,
kind_of
(
Hash
)).
and_return
([])
described_class
.
new
(
repository
).
commit_deltas
(
commit
)
end
...
...
@@ -76,7 +76,7 @@ describe Gitlab::GitalyClient::Commit do
right_commit_id:
initial_commit
.
id
)
expect_any_instance_of
(
Gitaly
::
Diff
::
Stub
).
to
receive
(
:commit_delta
).
with
(
request
,
kind_of
(
Hash
)).
and_return
([])
expect_any_instance_of
(
Gitaly
::
Diff
Service
::
Stub
).
to
receive
(
:commit_delta
).
with
(
request
,
kind_of
(
Hash
)).
and_return
([])
described_class
.
new
(
repository
).
commit_deltas
(
initial_commit
)
end
...
...
spec/lib/gitlab/gitaly_client/notification
s
_spec.rb
→
spec/lib/gitlab/gitaly_client/notification
_service
_spec.rb
浏览文件 @
a89f18bf
require
'spec_helper'
describe
Gitlab
::
GitalyClient
::
Notification
s
do
describe
Gitlab
::
GitalyClient
::
Notification
Service
do
describe
'#post_receive'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:storage_name
)
{
project
.
repository_storage
}
...
...
@@ -8,7 +8,7 @@ describe Gitlab::GitalyClient::Notifications do
subject
{
described_class
.
new
(
project
.
repository
)
}
it
'sends a post_receive message'
do
expect_any_instance_of
(
Gitaly
::
Notification
s
::
Stub
)
expect_any_instance_of
(
Gitaly
::
Notification
Service
::
Stub
)
.
to
receive
(
:post_receive
).
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
subject
.
post_receive
...
...
spec/lib/gitlab/gitaly_client/ref_spec.rb
→
spec/lib/gitlab/gitaly_client/ref_s
ervice_s
pec.rb
浏览文件 @
a89f18bf
require
'spec_helper'
describe
Gitlab
::
GitalyClient
::
Ref
do
describe
Gitlab
::
GitalyClient
::
Ref
Service
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:storage_name
)
{
project
.
repository_storage
}
let
(
:relative_path
)
{
project
.
path_with_namespace
+
'.git'
}
...
...
@@ -8,7 +8,7 @@ describe Gitlab::GitalyClient::Ref do
describe
'#branch_names'
do
it
'sends a find_all_branch_names message'
do
expect_any_instance_of
(
Gitaly
::
Ref
::
Stub
)
expect_any_instance_of
(
Gitaly
::
Ref
Service
::
Stub
)
.
to
receive
(
:find_all_branch_names
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
([])
...
...
@@ -19,7 +19,7 @@ describe Gitlab::GitalyClient::Ref do
describe
'#tag_names'
do
it
'sends a find_all_tag_names message'
do
expect_any_instance_of
(
Gitaly
::
Ref
::
Stub
)
expect_any_instance_of
(
Gitaly
::
Ref
Service
::
Stub
)
.
to
receive
(
:find_all_tag_names
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
([])
...
...
@@ -30,7 +30,7 @@ describe Gitlab::GitalyClient::Ref do
describe
'#default_branch_name'
do
it
'sends a find_default_branch_name message'
do
expect_any_instance_of
(
Gitaly
::
Ref
::
Stub
)
expect_any_instance_of
(
Gitaly
::
Ref
Service
::
Stub
)
.
to
receive
(
:find_default_branch_name
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
(
double
(
name:
'foo'
))
...
...
@@ -41,7 +41,7 @@ describe Gitlab::GitalyClient::Ref do
describe
'#local_branches'
do
it
'sends a find_local_branches message'
do
expect_any_instance_of
(
Gitaly
::
Ref
::
Stub
)
expect_any_instance_of
(
Gitaly
::
Ref
Service
::
Stub
)
.
to
receive
(
:find_local_branches
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
([])
...
...
@@ -50,7 +50,7 @@ describe Gitlab::GitalyClient::Ref do
end
it
'parses and sends the sort parameter'
do
expect_any_instance_of
(
Gitaly
::
Ref
::
Stub
)
expect_any_instance_of
(
Gitaly
::
Ref
Service
::
Stub
)
.
to
receive
(
:find_local_branches
)
.
with
(
gitaly_request_with_params
(
sort_by: :UPDATED_DESC
),
kind_of
(
Hash
))
.
and_return
([])
...
...
@@ -59,7 +59,7 @@ describe Gitlab::GitalyClient::Ref do
end
it
'translates known mismatches on sort param values'
do
expect_any_instance_of
(
Gitaly
::
Ref
::
Stub
)
expect_any_instance_of
(
Gitaly
::
Ref
Service
::
Stub
)
.
to
receive
(
:find_local_branches
)
.
with
(
gitaly_request_with_params
(
sort_by: :NAME
),
kind_of
(
Hash
))
.
and_return
([])
...
...
spec/lib/gitlab/gitaly_client_spec.rb
浏览文件 @
a89f18bf
...
...
@@ -16,9 +16,9 @@ describe Gitlab::GitalyClient, lib: true, skip_gitaly_mock: true do
'default'
=>
{
'gitaly_address'
=>
address
}
})
expect
(
Gitaly
::
Commit
::
Stub
).
to
receive
(
:new
).
with
(
address
,
any_args
)
expect
(
Gitaly
::
Commit
Service
::
Stub
).
to
receive
(
:new
).
with
(
address
,
any_args
)
described_class
.
stub
(
:commit
,
'default'
)
described_class
.
stub
(
:commit
_service
,
'default'
)
end
end
...
...
@@ -31,9 +31,9 @@ describe Gitlab::GitalyClient, lib: true, skip_gitaly_mock: true do
'default'
=>
{
'gitaly_address'
=>
prefixed_address
}
})
expect
(
Gitaly
::
Commit
::
Stub
).
to
receive
(
:new
).
with
(
address
,
any_args
)
expect
(
Gitaly
::
Commit
Service
::
Stub
).
to
receive
(
:new
).
with
(
address
,
any_args
)
described_class
.
stub
(
:commit
,
'default'
)
described_class
.
stub
(
:commit
_service
,
'default'
)
end
end
end
...
...
spec/requests/api/internal_spec.rb
浏览文件 @
a89f18bf
...
...
@@ -594,10 +594,10 @@ describe API::Internal do
# end
#
# it "calls the Gitaly client with the project's repository" do
# expect(Gitlab::GitalyClient::Notification
s
).
# expect(Gitlab::GitalyClient::Notification
Service
).
# to receive(:new).with(gitlab_git_repository_with(path: project.repository.path)).
# and_call_original
# expect_any_instance_of(Gitlab::GitalyClient::Notification
s
).
# expect_any_instance_of(Gitlab::GitalyClient::Notification
Service
).
# to receive(:post_receive)
#
# post api("/internal/notify_post_receive"), valid_params
...
...
@@ -606,10 +606,10 @@ describe API::Internal do
# end
#
# it "calls the Gitaly client with the wiki's repository if it's a wiki" do
# expect(Gitlab::GitalyClient::Notification
s
).
# expect(Gitlab::GitalyClient::Notification
Service
).
# to receive(:new).with(gitlab_git_repository_with(path: project.wiki.repository.path)).
# and_call_original
# expect_any_instance_of(Gitlab::GitalyClient::Notification
s
).
# expect_any_instance_of(Gitlab::GitalyClient::Notification
Service
).
# to receive(:post_receive)
#
# post api("/internal/notify_post_receive"), valid_wiki_params
...
...
@@ -618,7 +618,7 @@ describe API::Internal do
# end
#
# it "returns 500 if the gitaly call fails" do
# expect_any_instance_of(Gitlab::GitalyClient::Notification
s
).
# expect_any_instance_of(Gitlab::GitalyClient::Notification
Service
).
# to receive(:post_receive).and_raise(GRPC::Unavailable)
#
# post api("/internal/notify_post_receive"), valid_params
...
...
@@ -636,10 +636,10 @@ describe API::Internal do
# end
#
# it "calls the Gitaly client with the project's repository" do
# expect(Gitlab::GitalyClient::Notification
s
).
# expect(Gitlab::GitalyClient::Notification
Service
).
# to receive(:new).with(gitlab_git_repository_with(path: project.repository.path)).
# and_call_original
# expect_any_instance_of(Gitlab::GitalyClient::Notification
s
).
# expect_any_instance_of(Gitlab::GitalyClient::Notification
Service
).
# to receive(:post_receive)
#
# post api("/internal/notify_post_receive"), valid_params
...
...
@@ -648,10 +648,10 @@ describe API::Internal do
# end
#
# it "calls the Gitaly client with the wiki's repository if it's a wiki" do
# expect(Gitlab::GitalyClient::Notification
s
).
# expect(Gitlab::GitalyClient::Notification
Service
).
# to receive(:new).with(gitlab_git_repository_with(path: project.wiki.repository.path)).
# and_call_original
# expect_any_instance_of(Gitlab::GitalyClient::Notification
s
).
# expect_any_instance_of(Gitlab::GitalyClient::Notification
Service
).
# to receive(:post_receive)
#
# post api("/internal/notify_post_receive"), valid_wiki_params
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录