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
290175f4
Commit
290175f4
authored
Mar 18, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for Geo::ProjectRegistryVerificationFailedFinder
parent
d8195031
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
+107
-0
ee/spec/finders/geo/project_registry_verification_failed_finder_spec.rb
...s/geo/project_registry_verification_failed_finder_spec.rb
+107
-0
No files found.
ee/spec/finders/geo/project_registry_verification_failed_finder_spec.rb
0 → 100644
View file @
290175f4
# frozen_string_literal: true
require
'spec_helper'
describe
Geo
::
ProjectRegistryVerificationFailedFinder
,
:geo
do
# Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
describe
'#execute'
,
:delete
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
,
group:
nested_group_1
)
}
let
(
:project_4
)
{
create
(
:project
,
:broken_storage
,
group:
group_2
)
}
let
(
:project_5
)
{
create
(
:project
,
:broken_storage
,
group:
group_2
)
}
let!
(
:registry_verification_failed
)
{
create
(
:geo_project_registry
,
:repository_verification_failed
,
:wiki_verification_failed
,
project:
project_1
)
}
let!
(
:registry_repository_verification_failed
)
{
create
(
:geo_project_registry
,
:repository_verification_failed
,
:wiki_verified
,
project:
project_2
)
}
let!
(
:registry_wiki_verification_failed
)
{
create
(
:geo_project_registry
,
:repository_verified
,
:wiki_verification_failed
,
project:
project_3
)
}
let!
(
:registry_wiki_verification_failed_broken_shard
)
{
create
(
:geo_project_registry
,
:repository_verified
,
:wiki_verification_failed
,
project:
project_4
)
}
let!
(
:registry_repository_verification_failed_broken_shard
)
{
create
(
:geo_project_registry
,
:repository_verification_failed
,
:wiki_verified
,
project:
project_5
)
}
let!
(
:registry_verified
)
{
create
(
:geo_project_registry
,
:repository_verified
,
:wiki_verified
)
}
before
do
skip
(
'FDW is not configured'
)
unless
Gitlab
::
Geo
::
Fdw
.
enabled?
end
context
'with repository type'
do
subject
{
described_class
.
new
(
current_node:
node
,
type: :repository
)
}
context
'without selective sync'
do
it
'returns all failed registries'
do
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_verification_failed
,
registry_repository_verification_failed
,
registry_repository_verification_failed_broken_shard
)
end
end
context
'with selective sync by namespace'
do
it
'returns failed registries where projects belongs to the namespaces'
do
node
.
update!
(
selective_sync_type:
'namespaces'
,
namespaces:
[
group_1
,
nested_group_1
])
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_verification_failed
,
registry_repository_verification_failed
)
end
end
context
'with selective sync by shard'
do
it
'returns failed registries where projects belongs to the shards'
do
node
.
update!
(
selective_sync_type:
'shards'
,
selective_sync_shards:
[
'broken'
])
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_repository_verification_failed_broken_shard
)
end
end
end
context
'with wiki type'
do
subject
{
described_class
.
new
(
current_node:
node
,
type: :wiki
)
}
context
'without selective sync'
do
it
'returns all failed registries'
do
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_verification_failed
,
registry_wiki_verification_failed
,
registry_wiki_verification_failed_broken_shard
)
end
end
context
'with selective sync by namespace'
do
it
'returns failed registries where projects belongs to the namespaces'
do
node
.
update!
(
selective_sync_type:
'namespaces'
,
namespaces:
[
group_1
,
nested_group_1
])
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_verification_failed
,
registry_wiki_verification_failed
)
end
end
context
'with selective sync by shard'
do
it
'returns failed registries where projects belongs to the shards'
do
node
.
update!
(
selective_sync_type:
'shards'
,
selective_sync_shards:
[
'broken'
])
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_wiki_verification_failed_broken_shard
)
end
end
end
context
'with no type'
do
subject
{
described_class
.
new
(
current_node:
node
,
type: :invalid
)
}
context
'without selective sync'
do
it
'returns all failed registries'
do
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_verification_failed
,
registry_repository_verification_failed
,
registry_wiki_verification_failed
,
registry_repository_verification_failed_broken_shard
,
registry_wiki_verification_failed_broken_shard
)
end
end
context
'with selective sync by namespace'
do
it
'returns all failed registries where projects belongs to the namespaces'
do
node
.
update!
(
selective_sync_type:
'namespaces'
,
namespaces:
[
group_1
,
nested_group_1
])
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_verification_failed
,
registry_repository_verification_failed
,
registry_wiki_verification_failed
)
end
end
context
'with selective sync by shard'
do
it
'returns all failed registries where projects belongs to the shards'
do
node
.
update!
(
selective_sync_type:
'shards'
,
selective_sync_shards:
[
'broken'
])
expect
(
subject
.
execute
).
to
contain_exactly
(
registry_repository_verification_failed_broken_shard
,
registry_wiki_verification_failed_broken_shard
)
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