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
907d35e7
Commit
907d35e7
authored
Aug 09, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for API::Geo when node has namespace restrictions
parent
691af412
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
spec/requests/api/geo_spec.rb
spec/requests/api/geo_spec.rb
+36
-0
No files found.
spec/requests/api/geo_spec.rb
View file @
907d35e7
...
...
@@ -49,6 +49,42 @@ describe API::Geo do
end
end
describe
'POST /geo/receive_events when node has namespace restrictions'
do
let
(
:synced_group
)
{
create
(
:group
)
}
let
(
:secondary_node
)
{
create
(
:geo_node
,
namespaces:
[
synced_group
])
}
let
(
:push_payload
)
do
{
'event_name'
=>
'push'
,
'project'
=>
{
'git_ssh_url'
=>
'git@example.com:mike/diaspora.git'
}
}
end
before
(
:each
)
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:current_node
)
{
secondary_node
}
allow_any_instance_of
(
::
Geo
::
ScheduleRepoUpdateService
).
to
receive
(
:execute
)
allow_any_instance_of
(
::
Geo
::
ScheduleRepoFetchService
).
to
receive
(
:execute
)
end
it
'responds with not found for projects that do not belong to selected namespaces to replicate'
do
unsynced_project
=
create
(
:project
)
post
api
(
'/geo/receive_events'
),
push_payload
.
merge
(
'project_id'
=>
unsynced_project
.
id
),
geo_token_header
expect
(
response
).
to
have_http_status
(
404
)
end
it
'responds with success for projects that belong to selected namespaces to replicate'
do
project_in_synced_group
=
create
(
:project
,
group:
synced_group
)
post
api
(
'/geo/receive_events'
),
push_payload
.
merge
(
'project_id'
=>
project_in_synced_group
.
id
),
geo_token_header
expect
(
response
).
to
have_http_status
(
201
)
end
end
describe
'POST /geo/receive_events key events'
do
before
do
allow_any_instance_of
(
::
Geo
::
ScheduleKeyChangeService
).
to
receive
(
:execute
)
...
...
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