Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hgitaly
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
heptapod
hgitaly
Commits
9290e989
Commit
9290e989
authored
3 years ago
by
Sushil Khanchi
Browse files
Options
Downloads
Patches
Plain Diff
CreateRepository: add gitaly comparison tests
parent
25514844
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!64
RepositoryService: implement CreateRepository
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests_with_gitaly/test_repository_service.py
+42
-0
42 additions, 0 deletions
tests_with_gitaly/test_repository_service.py
with
42 additions
and
0 deletions
tests_with_gitaly/test_repository_service.py
+
42
−
0
View file @
9290e989
...
...
@@ -12,4 +12,5 @@
import
grpc
import
itertools
# from hgitaly.git import EMPTY_TREE_OID
from
hgitaly.stub.shared_pb2
import
Repository
from
hgitaly.stub.repository_service_pb2
import
(
...
...
@@ -15,4 +16,5 @@
from
hgitaly.stub.repository_service_pb2
import
(
CreateRepositoryRequest
,
FindMergeBaseRequest
,
)
from
hgitaly.stub.repository_service_pb2_grpc
import
RepositoryServiceStub
...
...
@@ -96,3 +98,43 @@
==
do_rpc
(
'
git
'
,
[
git_shas
[
sha0
],
sha_not_exists
])
)
def
test_create_repository
(
gitaly_channel
,
grpc_channel
,
server_repos_root
):
rel_path
=
'
sample_repo
'
default_storage
=
'
default
'
repo_stubs
=
dict
(
hg
=
RepositoryServiceStub
(
grpc_channel
),
git
=
RepositoryServiceStub
(
gitaly_channel
)
)
def
do_rpc
(
vcs
,
rel_path
,
storage
=
default_storage
):
grpc_repo
=
Repository
(
relative_path
=
rel_path
,
storage_name
=
storage
)
request
=
CreateRepositoryRequest
(
repository
=
grpc_repo
)
response
=
repo_stubs
[
vcs
].
CreateRepository
(
request
)
return
response
# actual test
assert
do_rpc
(
'
hg
'
,
rel_path
)
==
do_rpc
(
'
git
'
,
rel_path
)
# when storage name is invalid
with
pytest
.
raises
(
grpc
.
RpcError
)
as
exc_info_hg
:
do_rpc
(
'
hg
'
,
rel_path
,
storage
=
'
cargoship
'
)
with
pytest
.
raises
(
grpc
.
RpcError
)
as
exc_info_git
:
do_rpc
(
'
git
'
,
rel_path
,
storage
=
'
cargoship
'
)
assert
exc_info_hg
.
value
.
code
()
==
exc_info_git
.
value
.
code
()
assert
'
no such storage
'
in
exc_info_hg
.
value
.
details
()
assert
'
no such storage
'
in
exc_info_git
.
value
.
details
()
# test with a broken symlink (which points to itself)
repo_name
=
"
myrepo_a_broken_symlink
"
path
=
(
server_repos_root
/
default_storage
/
repo_name
)
path
.
symlink_to
(
path
)
with
pytest
.
raises
(
grpc
.
RpcError
)
as
exc_info_hg
:
do_rpc
(
'
hg
'
,
repo_name
)
with
pytest
.
raises
(
grpc
.
RpcError
)
as
exc_info_git
:
do_rpc
(
'
git
'
,
repo_name
)
assert
exc_info_hg
.
value
.
code
()
==
exc_info_git
.
value
.
code
()
assert
'
Too many levels of symbolic links
'
in
exc_info_hg
.
value
.
details
()
assert
'
file exists
'
in
exc_info_git
.
value
.
details
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment