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
d27c5f82
Commit
d27c5f82
authored
Jan 03, 2017
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed specs and added TODOs to mark which pieces of code need to be fixed on the next iteration.
parent
2aef8c6e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
2 deletions
+51
-2
app/workers/geo_repository_fetch_worker.rb
app/workers/geo_repository_fetch_worker.rb
+1
-0
app/workers/geo_repository_update_worker.rb
app/workers/geo_repository_update_worker.rb
+8
-0
app/workers/post_receive.rb
app/workers/post_receive.rb
+1
-0
spec/workers/geo_repository_fetch_worker_spec.rb
spec/workers/geo_repository_fetch_worker_spec.rb
+37
-0
spec/workers/geo_repository_update_worker_spec.rb
spec/workers/geo_repository_update_worker_spec.rb
+4
-2
No files found.
app/workers/geo_repository_fetch_worker.rb
View file @
d27c5f82
# TODO: Remove me once Geo is fixed
class
GeoRepositoryFetchWorker
include
Sidekiq
::
Worker
include
Gitlab
::
ShellAdapter
...
...
app/workers/geo_repository_update_worker.rb
View file @
d27c5f82
...
...
@@ -9,11 +9,19 @@ class GeoRepositoryUpdateWorker
@project
=
Project
.
find
(
project_id
)
@push_data
=
push_data
# TODO: Enable fetch once Geo is fixed
# fetch_repository(clone_url)
process_hooks
if
push_data
# we should be compatible with old unprocessed data
end
private
def
fetch_repository
(
remote_url
)
@project
.
create_repository
unless
@project
.
repository_exists?
@project
.
repository
.
after_create
if
@project
.
empty_repo?
@project
.
repository
.
fetch_geo_mirror
(
remote_url
)
end
def
process_hooks
if
@push_data
[
'type'
]
==
'push'
branch
=
Gitlab
::
Git
.
ref_name
(
@push_data
[
'ref'
])
...
...
app/workers/post_receive.rb
View file @
d27c5f82
...
...
@@ -27,6 +27,7 @@ class PostReceive
# Triggers repository update on secondary nodes when Geo is enabled
Gitlab
::
Geo
.
notify_wiki_update
(
post_received
.
project
)
if
Gitlab
::
Geo
.
enabled?
elsif
post_received
.
regular_project?
# TODO: Remove this if block once Geo is fixed
if
Gitlab
::
Geo
.
enabled?
hook_data
=
{
project_id:
post_received
.
project
.
id
,
...
...
spec/workers/geo_repository_fetch_worker_spec.rb
0 → 100644
View file @
d27c5f82
require
'spec_helper'
# TODO: Remove me once Geo is fixed
describe
GeoRepositoryFetchWorker
do
describe
'#perform'
do
let
(
:project
)
{
create
(
:empty_project
)
}
before
do
allow_any_instance_of
(
Gitlab
::
Geo
).
to
receive_messages
(
secondary?:
true
)
allow_any_instance_of
(
Repository
).
to
receive
(
:fetch_geo_mirror
).
and_return
(
true
)
allow_any_instance_of
(
Project
).
to
receive
(
:repository_exists?
)
{
false
}
allow_any_instance_of
(
Project
).
to
receive
(
:empty_repo?
)
{
true
}
end
it
'creates a new repository'
do
expect_any_instance_of
(
Project
).
to
receive
(
:create_repository
)
perform
end
it
'executes after_create hook'
do
expect_any_instance_of
(
Repository
).
to
receive
(
:after_create
).
at_least
(
:once
)
perform
end
it
'fetches the Geo mirror'
do
expect_any_instance_of
(
Repository
).
to
receive
(
:fetch_geo_mirror
)
perform
end
end
def
perform
subject
.
perform
(
project
.
id
,
project
.
ssh_url_to_repo
)
end
end
spec/workers/geo_repository_update_worker_spec.rb
View file @
d27c5f82
...
...
@@ -36,13 +36,15 @@ describe GeoRepositoryUpdateWorker do
allow
(
project
).
to
receive
(
:repository_exists?
)
{
false
}
end
it
'creates a new repository'
do
# TODO: Enable again once Geo update has been properly fixed.
# See !1015 for more info
xit
'creates a new repository'
do
expect
(
project
).
to
receive
(
:create_repository
)
performed
end
it
'executes after_create hook'
do
x
it
'executes after_create hook'
do
expect
(
project
.
repository
).
to
receive
(
:after_create
)
performed
...
...
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