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
cad600ad
Commit
cad600ad
authored
Sep 17, 2020
by
Douglas Barbosa Alexandre
Committed by
Michael Kozono
Sep 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo - Create repository updated events only if the repository exists
parent
2ff3c889
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
8 deletions
+32
-8
ee/app/services/geo/repository_updated_service.rb
ee/app/services/geo/repository_updated_service.rb
+9
-6
ee/changelogs/unreleased/250315-fix-create-repository-updated-events.yml
...nreleased/250315-fix-create-repository-updated-events.yml
+5
-0
ee/spec/services/geo/repository_updated_service_spec.rb
ee/spec/services/geo/repository_updated_service_spec.rb
+18
-2
No files found.
ee/app/services/geo/repository_updated_service.rb
View file @
cad600ad
...
...
@@ -10,6 +10,7 @@ module Geo
def
initialize
(
repository
,
params
=
{})
@project
=
repository
.
project
@repository
=
repository
@params
=
params
@refs
=
params
.
fetch
(
:refs
,
[])
@changes
=
params
.
fetch
(
:changes
,
[])
...
...
@@ -27,11 +28,13 @@ module Geo
private
attr_reader
:project
,
:refs
,
:changes
,
:source
attr_reader
:project
,
:re
pository
,
:re
fs
,
:changes
,
:source
delegate
:repository_state
,
to: :project
def
create_repository_updated_event!
return
unless
repository
.
exists?
Geo
::
RepositoryUpdatedEventStore
.
new
(
project
,
refs:
refs
,
changes:
changes
,
source:
source
).
create!
...
...
ee/changelogs/unreleased/250315-fix-create-repository-updated-events.yml
0 → 100644
View file @
cad600ad
---
title
:
Geo - Create repository updated events only if the repository exists
merge_request
:
42519
author
:
type
:
fixed
ee/spec/services/geo/repository_updated_service_spec.rb
View file @
cad600ad
...
...
@@ -37,10 +37,18 @@ RSpec.describe Geo::RepositoryUpdatedService do
end
context
'when running on a primary node'
do
it
'creates a repository updated event'
do
it
'creates a repository updated event when repository exists'
do
allow
(
repository
).
to
receive
(
:exists?
).
and_return
(
true
)
expect
{
subject
.
execute
}.
to
change
(
Geo
::
RepositoryUpdatedEvent
,
:count
).
by
(
1
)
end
it
'does not create a repository updated event when repository does not exist'
do
allow
(
repository
).
to
receive
(
:exists?
).
and_return
(
false
)
expect
{
subject
.
execute
}.
not_to
change
(
Geo
::
RepositoryUpdatedEvent
,
:count
)
end
it
'resets the repository verification checksum'
do
expect
{
subject
.
execute
}.
to
change
{
repository_state
.
reload
.
public_send
(
"
#{
method_prefix
}
_verification_checksum"
)
}.
to
(
nil
)
end
...
...
@@ -91,9 +99,17 @@ RSpec.describe Geo::RepositoryUpdatedService do
context
'when design repository is being updated'
do
let
(
:repository
)
{
project
.
design_repository
}
it
'creates a design repository updated event'
do
it
'creates a design repository updated event when repository exists'
do
allow
(
repository
).
to
receive
(
:exists?
).
and_return
(
true
)
expect
{
subject
.
execute
}.
to
change
(
Geo
::
RepositoryUpdatedEvent
,
:count
).
by
(
1
)
end
it
'does not create a repository updated event when repository does not exist'
do
allow
(
repository
).
to
receive
(
:exists?
).
and_return
(
false
)
expect
{
subject
.
execute
}.
not_to
change
(
Geo
::
RepositoryUpdatedEvent
,
:count
)
end
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