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
2a7b73c5
Commit
2a7b73c5
authored
Jul 29, 2020
by
Mike Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup GeoNode with factory
...instead of a helper method.
parent
8cf121e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
46 deletions
+51
-46
ee/spec/factories/geo_nodes.rb
ee/spec/factories/geo_nodes.rb
+41
-0
ee/spec/models/ee/ci/job_artifact_spec.rb
ee/spec/models/ee/ci/job_artifact_spec.rb
+5
-5
ee/spec/models/upload_spec.rb
ee/spec/models/upload_spec.rb
+5
-5
ee/spec/support/helpers/ee/geo_helpers.rb
ee/spec/support/helpers/ee/geo_helpers.rb
+0
-36
No files found.
ee/spec/factories/geo_nodes.rb
View file @
2a7b73c5
...
@@ -23,4 +23,45 @@ FactoryBot.define do
...
@@ -23,4 +23,45 @@ FactoryBot.define do
sync_object_storage
{
false
}
sync_object_storage
{
false
}
end
end
end
end
factory
:geo_node_with_selective_sync_for
,
parent: :geo_node
do
transient
do
model
{
nil
}
namespaces
{
nil
}
shards
{
nil
}
end
after
:build
do
|
node
,
options
|
namespaces
=
options
.
namespaces
shards
=
options
.
shards
model
=
options
.
model
if
namespaces
node
.
selective_sync_type
=
'namespaces'
elsif
shards
node
.
selective_sync_type
=
'shards'
end
case
namespaces
when
:model
node
.
namespaces
=
[
model
]
when
:model_parent
node
.
namespaces
=
[
model
.
parent
]
when
:model_parent_parent
node
.
namespaces
=
[
model
.
parent
.
parent
]
when
:other
node
.
namespaces
=
[
create
(
:group
)]
end
case
shards
when
:model
node
.
selective_sync_shards
=
[
model
.
repository_storage
]
when
:model_project
project
=
create
(
:project
,
namespace:
model
)
node
.
selective_sync_shards
=
[
project
.
repository_storage
]
when
:other
node
.
selective_sync_shards
=
[
'other_shard_name'
]
end
end
end
end
end
ee/spec/models/ee/ci/job_artifact_spec.rb
View file @
2a7b73c5
...
@@ -138,11 +138,11 @@ RSpec.describe Ci::JobArtifact do
...
@@ -138,11 +138,11 @@ RSpec.describe Ci::JobArtifact do
let
(
:project
)
{
create
(
*
project_factory
)
}
let
(
:project
)
{
create
(
*
project_factory
)
}
let
(
:ci_build
)
{
create
(
:ci_build
,
project:
project
)
}
let
(
:ci_build
)
{
create
(
:ci_build
,
project:
project
)
}
let
(
:node
)
do
let
(
:node
)
do
create
_geo_node_to_test_replicables_for_geo_node
(
create
(
:geo_node_with_selective_sync_for
,
project
,
model:
project
,
selective_sync_
namespaces:
selective_sync_namespaces
,
namespaces:
selective_sync_namespaces
,
selective_sync_
shards:
selective_sync_shards
,
shards:
selective_sync_shards
,
sync_object_storage:
sync_object_storage
)
sync_object_storage:
sync_object_storage
)
end
end
before
do
before
do
...
...
ee/spec/models/upload_spec.rb
View file @
2a7b73c5
...
@@ -41,11 +41,11 @@ RSpec.describe Upload do
...
@@ -41,11 +41,11 @@ RSpec.describe Upload do
let
(
:model
)
{
create
(
*
model_factory
)
}
let
(
:model
)
{
create
(
*
model_factory
)
}
let
(
:node
)
do
let
(
:node
)
do
create
_geo_node_to_test_replicables_for_geo_node
(
create
(
:geo_node_with_selective_sync_for
,
model
,
model:
model
,
selective_sync_
namespaces:
selective_sync_namespaces
,
namespaces:
selective_sync_namespaces
,
selective_sync_
shards:
selective_sync_shards
,
shards:
selective_sync_shards
,
sync_object_storage:
sync_object_storage
)
sync_object_storage:
sync_object_storage
)
end
end
before
do
before
do
...
...
ee/spec/support/helpers/ee/geo_helpers.rb
View file @
2a7b73c5
...
@@ -117,41 +117,5 @@ module EE
...
@@ -117,41 +117,5 @@ module EE
drop_table
:dummy_models
,
force:
true
drop_table
:dummy_models
,
force:
true
end
end
end
end
def
create_geo_node_to_test_replicables_for_geo_node
(
model
,
selective_sync_namespaces:
nil
,
selective_sync_shards:
nil
,
sync_object_storage
:)
node
=
build
(
:geo_node
)
if
selective_sync_namespaces
node
.
selective_sync_type
=
'namespaces'
elsif
selective_sync_shards
node
.
selective_sync_type
=
'shards'
end
case
selective_sync_namespaces
when
:model
node
.
namespaces
=
[
model
]
when
:model_parent
node
.
namespaces
=
[
model
.
parent
]
when
:model_parent_parent
node
.
namespaces
=
[
model
.
parent
.
parent
]
when
:other
node
.
namespaces
=
[
create
(
:group
)]
end
case
selective_sync_shards
when
:model
node
.
selective_sync_shards
=
[
model
.
repository_storage
]
when
:model_project
project
=
create
(
:project
,
namespace:
model
)
node
.
selective_sync_shards
=
[
project
.
repository_storage
]
when
:other
node
.
selective_sync_shards
=
[
'other_shard_name'
]
end
node
.
sync_object_storage
=
sync_object_storage
node
.
save!
node
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