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
24d02421
Commit
24d02421
authored
Apr 29, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor specs to reuse shared examples
Remove duplicatin between spec files.
parent
382eb16d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
154 deletions
+23
-154
ee/spec/finders/geo/attachment_registry_finder_spec.rb
ee/spec/finders/geo/attachment_registry_finder_spec.rb
+1
-47
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
+1
-49
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
+1
-49
ee/spec/support/shared_examples/finders/file_registry_finders.rb
.../support/shared_examples/finders/file_registry_finders.rb
+20
-9
No files found.
ee/spec/finders/geo/attachment_registry_finder_spec.rb
View file @
24d02421
...
...
@@ -28,25 +28,6 @@ describe Geo::AttachmentRegistryFinder, :geo do
stub_current_geo_node
(
secondary
)
end
it
'responds to file registry finder methods'
do
file_registry_finder_methods
=
%i{
syncable
count_syncable
count_synced
count_failed
count_synced_missing_on_primary
count_registry
find_unsynced
find_migrated_local
find_retryable_failed_registries
find_retryable_synced_missing_on_primary_registries
}
file_registry_finder_methods
.
each
do
|
method
|
expect
(
subject
).
to
respond_to
(
method
)
end
end
shared_examples
'finds all the things'
do
describe
'#find_unsynced'
do
it
'returns uploads without an entry on the tracking database'
do
...
...
@@ -439,32 +420,5 @@ describe Geo::AttachmentRegistryFinder, :geo do
end
end
context
'FDW'
,
:geo_fdw
do
context
'with use_fdw_queries_for_selective_sync disabled'
do
before
do
stub_feature_flags
(
use_fdw_queries_for_selective_sync:
false
)
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
context
'with use_fdw_queries_for_selective_sync enabled'
do
before
do
stub_feature_flags
(
use_fdw_queries_for_selective_sync:
true
)
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
end
context
'Legacy'
do
before
do
stub_fdw_disabled
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
it_behaves_like
'a file registry finder'
end
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
View file @
24d02421
...
...
@@ -20,25 +20,6 @@ describe Geo::JobArtifactRegistryFinder, :geo do
stub_artifacts_object_storage
end
it
'responds to file registry finder methods'
do
file_registry_finder_methods
=
%i{
syncable
count_syncable
count_synced
count_failed
count_synced_missing_on_primary
count_registry
find_unsynced
find_migrated_local
find_retryable_failed_registries
find_retryable_synced_missing_on_primary_registries
}
file_registry_finder_methods
.
each
do
|
method
|
expect
(
subject
).
to
respond_to
(
method
)
end
end
shared_examples
'counts all the things'
do
describe
'#count_syncable'
do
let!
(
:job_artifact_1
)
{
create
(
:ci_job_artifact
,
project:
synced_project
)
}
...
...
@@ -582,34 +563,5 @@ describe Geo::JobArtifactRegistryFinder, :geo do
end
end
# Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
context
'FDW'
,
:geo_fdw
,
:delete
do
context
'with use_fdw_queries_for_selective_sync disabled'
do
before
do
stub_feature_flags
(
use_fdw_queries_for_selective_sync:
false
)
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
context
'with use_fdw_queries_for_selective_sync enabled'
do
before
do
stub_feature_flags
(
use_fdw_queries_for_selective_sync:
true
)
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
end
context
'Legacy'
do
before
do
stub_fdw_disabled
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
it_behaves_like
'a file registry finder'
end
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
View file @
24d02421
...
...
@@ -31,25 +31,6 @@ describe Geo::LfsObjectRegistryFinder, :geo do
stub_lfs_object_storage
end
it
'responds to file registry finder methods'
do
file_registry_finder_methods
=
%i{
syncable
count_syncable
count_synced
count_failed
count_synced_missing_on_primary
count_registry
find_unsynced
find_migrated_local
find_retryable_failed_registries
find_retryable_synced_missing_on_primary_registries
}
file_registry_finder_methods
.
each
do
|
method
|
expect
(
subject
).
to
respond_to
(
method
)
end
end
shared_examples
'counts all the things'
do
describe
'#count_syncable'
do
before
do
...
...
@@ -661,34 +642,5 @@ describe Geo::LfsObjectRegistryFinder, :geo do
end
end
# Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
context
'FDW'
,
:geo_fdw
,
:delete
do
context
'with use_fdw_queries_for_selective_sync disabled'
do
before
do
stub_feature_flags
(
use_fdw_queries_for_selective_sync:
false
)
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
context
'with use_fdw_queries_for_selective_sync enabled'
do
before
do
stub_feature_flags
(
use_fdw_queries_for_selective_sync:
true
)
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
end
context
'Legacy'
do
before
do
stub_fdw_disabled
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
it_behaves_like
'a file registry finder'
end
ee/spec/support/shared_examples/finders/file_registry_finders.rb
View file @
24d02421
...
...
@@ -18,23 +18,34 @@ shared_examples_for 'a file registry finder' do
end
end
context
'FDW'
,
:geo_fdw
do
include_examples
'counts all the things'
# Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
context
'FDW'
,
:geo_fdw
,
:delete
do
context
'with use_fdw_queries_for_selective_sync disabled'
do
before
do
stub_feature_flags
(
use_fdw_queries_for_selective_sync:
false
)
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
include_examples
'finds all the things'
do
let
(
:method_prefix
)
{
'fdw'
}
context
'with use_fdw_queries_for_selective_sync enabled'
do
before
do
stub_feature_flags
(
use_fdw_queries_for_selective_sync:
true
)
end
include_examples
'counts all the things'
include_examples
'finds all the things'
end
end
context
'Legacy'
do
before
do
allow
(
Gitlab
::
Geo
::
Fdw
).
to
receive
(
:enabled?
).
and_return
(
false
)
stub_fdw_disabled
end
include_examples
'counts all the things'
include_examples
'finds all the things'
do
let
(
:method_prefix
)
{
'legacy'
}
end
include_examples
'finds all the things'
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