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
074b5ccf
Commit
074b5ccf
authored
Jul 29, 2020
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused method to find projects outside selective sync
parent
826eedf4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
79 deletions
+0
-79
ee/app/models/geo/fdw/geo_node.rb
ee/app/models/geo/fdw/geo_node.rb
+0
-12
ee/app/models/geo/fdw/project.rb
ee/app/models/geo/fdw/project.rb
+0
-9
ee/spec/models/geo/fdw/geo_node_spec.rb
ee/spec/models/geo/fdw/geo_node_spec.rb
+0
-58
No files found.
ee/app/models/geo/fdw/geo_node.rb
View file @
074b5ccf
...
@@ -14,18 +14,6 @@ module Geo
...
@@ -14,18 +14,6 @@ module Geo
has_many
:geo_node_namespace_links
,
class_name:
'Geo::Fdw::GeoNodeNamespaceLink'
has_many
:geo_node_namespace_links
,
class_name:
'Geo::Fdw::GeoNodeNamespaceLink'
has_many
:namespaces
,
class_name:
'Geo::Fdw::Namespace'
,
through: :geo_node_namespace_links
has_many
:namespaces
,
class_name:
'Geo::Fdw::Namespace'
,
through: :geo_node_namespace_links
def
projects_outside_selective_sync
projects
=
if
selective_sync_by_namespaces?
projects_outside_selected_namespaces
elsif
selective_sync_by_shards?
projects_outside_selected_shards
else
Geo
::
Fdw
::
Project
.
none
end
projects
.
inner_join_project_registry
end
def
projects
def
projects
return
Geo
::
Fdw
::
Project
.
all
unless
selective_sync?
return
Geo
::
Fdw
::
Project
.
all
unless
selective_sync?
...
...
ee/app/models/geo/fdw/project.rb
View file @
074b5ccf
...
@@ -56,15 +56,6 @@ module Geo
...
@@ -56,15 +56,6 @@ module Geo
def
within_shards
(
shard_names
)
def
within_shards
(
shard_names
)
where
(
repository_storage:
Array
(
shard_names
))
where
(
repository_storage:
Array
(
shard_names
))
end
end
def
inner_join_project_registry
join_statement
=
arel_table
.
join
(
Geo
::
ProjectRegistry
.
arel_table
,
Arel
::
Nodes
::
InnerJoin
)
.
on
(
arel_table
[
:id
].
eq
(
Geo
::
ProjectRegistry
.
arel_table
[
:project_id
]))
joins
(
join_statement
.
join_sources
)
end
end
end
end
end
end
end
...
...
ee/spec/models/geo/fdw/geo_node_spec.rb
View file @
074b5ccf
...
@@ -41,62 +41,4 @@ RSpec.describe Geo::Fdw::GeoNode, :geo, type: :model do
...
@@ -41,62 +41,4 @@ RSpec.describe Geo::Fdw::GeoNode, :geo, type: :model do
expect
(
subject
.
projects
).
to
be_empty
expect
(
subject
.
projects
).
to
be_empty
end
end
end
end
describe
'#projects_outside_selective_sync'
,
:geo_fdw
do
subject
{
described_class
.
find
(
node
.
id
)
}
let
(
:synced_group
)
{
create
(
:group
)
}
let
(
:synced_subgroup
)
{
create
(
:group
,
parent:
synced_group
)
}
let
(
:unsynced_group
)
{
create
(
:group
)
}
let
(
:project_1
)
{
create
(
:project
,
group:
synced_group
)
}
let
(
:project_2
)
{
create
(
:project
,
group:
synced_group
)
}
let!
(
:project_3
)
{
create
(
:project
,
:repository
,
group:
unsynced_group
)
}
let
(
:project_4
)
{
create
(
:project
,
:repository
,
group:
unsynced_group
)
}
let
(
:project_5
)
{
create
(
:project
,
group:
synced_subgroup
)
}
let
(
:project_6
)
{
create
(
:project
,
group:
synced_subgroup
)
}
let
(
:project_7
)
{
create
(
:project
)
}
let
(
:project_8
)
{
create
(
:project
)
}
before
do
create
(
:geo_project_registry
,
project:
project_1
)
create
(
:geo_project_registry
,
project:
project_2
)
create
(
:geo_project_registry
,
project:
project_4
)
create
(
:geo_project_registry
,
project:
project_5
)
create
(
:geo_project_registry
,
project:
project_6
)
create
(
:geo_project_registry
,
project:
project_7
)
create
(
:geo_project_registry
,
project:
project_8
)
end
def
projects_to_fdw
(
projects
)
projects
.
map
{
|
project
|
Geo
::
Fdw
::
Project
.
find
(
project
.
id
)
}
end
context
'with selective sync by namespace'
do
before
do
node
.
update!
(
selective_sync_type:
'namespaces'
,
namespaces:
[
synced_group
])
end
it
'returns projects that does not belong to the selected namespaces'
do
expected_projects
=
projects_to_fdw
([
project_4
,
project_7
,
project_8
])
expect
(
subject
.
projects_outside_selective_sync
).
to
eq
(
expected_projects
)
end
end
context
'with selective sync by shard'
do
before
do
project_7
.
update_column
(
:repository_storage
,
'broken'
)
project_8
.
update_column
(
:repository_storage
,
'broken'
)
node
.
update!
(
selective_sync_type:
'shards'
,
selective_sync_shards:
[
'broken'
])
end
it
'returns synced projects that does not belong to the selected shards'
do
expected_projects
=
projects_to_fdw
([
project_1
,
project_2
,
project_4
,
project_5
,
project_6
])
expect
(
subject
.
projects_outside_selective_sync
).
to
eq
(
expected_projects
)
end
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