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
bea90eb7
Commit
bea90eb7
authored
Aug 01, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Geo::RepositoriesChangedEventStore
parent
eb05dca4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
app/services/geo/repositories_changed_event_store.rb
app/services/geo/repositories_changed_event_store.rb
+26
-0
spec/services/geo/repositories_changed_event_store_spec.rb
spec/services/geo/repositories_changed_event_store_spec.rb
+21
-0
No files found.
app/services/geo/repositories_changed_event_store.rb
0 → 100644
View file @
bea90eb7
module
Geo
class
RepositoriesChangedEventStore
<
EventStore
self
.
event_type
=
:repositories_changed_event
attr_reader
:geo_node
def
initialize
(
geo_node
)
@geo_node
=
geo_node
end
private
def
build_event
Geo
::
RepositoriesChangedEvent
.
new
(
geo_node:
geo_node
)
end
def
log_error
(
message
,
error
)
Gitlab
::
Geo
::
Logger
.
error
(
class:
self
.
class
.
name
,
message:
message
,
error:
error
,
geo_node_id:
geo_node
.
id
,
geo_node_url:
geo_node
.
url
)
end
end
end
spec/services/geo/repositories_changed_event_store_spec.rb
0 → 100644
View file @
bea90eb7
require
'spec_helper'
describe
Geo
::
RepositoriesChangedEventStore
do
let
(
:geo_node
)
{
create
(
:geo_node
)
}
subject
{
described_class
.
new
(
geo_node
)
}
describe
'#create'
do
it
'does not create an event when not running on a primary node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:primary?
)
{
false
}
expect
{
subject
.
create
}.
not_to
change
(
Geo
::
RepositoriesChangedEvent
,
:count
)
end
it
'creates a repositories changed event when running on a primary node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:primary?
)
{
true
}
expect
{
subject
.
create
}.
to
change
(
Geo
::
RepositoriesChangedEvent
,
:count
).
by
(
1
)
end
end
end
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