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
88b47e7f
Commit
88b47e7f
authored
Jul 31, 2020
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Geo::Fdw::GeoNode#projects method
parent
b4665a80
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
61 deletions
+0
-61
ee/app/models/geo/fdw/geo_node.rb
ee/app/models/geo/fdw/geo_node.rb
+0
-27
ee/spec/models/geo/fdw/geo_node_spec.rb
ee/spec/models/geo/fdw/geo_node_spec.rb
+0
-34
No files found.
ee/app/models/geo/fdw/geo_node.rb
View file @
88b47e7f
...
...
@@ -13,33 +13,6 @@ module Geo
has_many
:geo_node_namespace_links
,
class_name:
'Geo::Fdw::GeoNodeNamespaceLink'
has_many
:namespaces
,
class_name:
'Geo::Fdw::Namespace'
,
through: :geo_node_namespace_links
def
projects
return
Geo
::
Fdw
::
Project
.
all
unless
selective_sync?
if
selective_sync_by_namespaces?
projects_for_selected_namespaces
elsif
selective_sync_by_shards?
projects_for_selected_shards
else
Geo
::
Fdw
::
Project
.
none
end
end
private
def
projects_for_selected_namespaces
Geo
::
Fdw
::
Project
.
within_namespaces
(
selected_namespaces_and_descendants
.
select
(
:id
))
end
def
projects_for_selected_shards
Geo
::
Fdw
::
Project
.
within_shards
(
selective_sync_shards
)
end
def
project_model
Geo
::
Fdw
::
Project
end
end
end
end
ee/spec/models/geo/fdw/geo_node_spec.rb
View file @
88b47e7f
...
...
@@ -3,42 +3,8 @@
require
'spec_helper'
RSpec
.
describe
Geo
::
Fdw
::
GeoNode
,
:geo
,
type: :model
do
let
(
:node
)
{
create
(
:geo_node
)
}
let
(
:group_1
)
{
create
(
:group
)
}
let
(
:group_2
)
{
create
(
:group
)
}
let
(
:nested_group_1
)
{
create
(
:group
,
parent:
group_1
)
}
let
(
:project_1
)
{
create
(
:project
,
group:
group_1
)
}
let
(
:project_2
)
{
create
(
:project
,
group:
nested_group_1
)
}
let
(
:project_3
)
{
create
(
:project
,
:broken_storage
,
group:
group_2
)
}
context
'relationships'
do
it
{
is_expected
.
to
have_many
(
:geo_node_namespace_links
).
class_name
(
'Geo::Fdw::GeoNodeNamespaceLink'
)
}
it
{
is_expected
.
to
have_many
(
:namespaces
).
class_name
(
'Geo::Fdw::Namespace'
).
through
(
:geo_node_namespace_links
)
}
end
describe
'#projects'
,
:geo_fdw
do
subject
{
described_class
.
find
(
node
.
id
)
}
it
'returns all registries without selective sync'
do
expect
(
subject
.
projects
).
to
match_ids
(
project_1
,
project_2
,
project_3
)
end
it
'returns projects that belong to the namespaces with selective sync by namespace'
do
node
.
update!
(
selective_sync_type:
'namespaces'
,
namespaces:
[
group_1
])
expect
(
subject
.
projects
).
to
match_ids
(
project_1
,
project_2
)
end
it
'returns projects that belong to the shards with selective sync by shard'
do
node
.
update!
(
selective_sync_type:
'shards'
,
selective_sync_shards:
%w[broken]
)
expect
(
subject
.
projects
).
to
match_ids
(
project_3
)
end
it
'returns nothing if an unrecognised selective sync type is used'
do
node
.
update_attribute
(
:selective_sync_type
,
'unknown'
)
expect
(
subject
.
projects
).
to
be_empty
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