Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2020-12-10 13:45:13 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2020-12-10 13:45:13 +0300
commit0a0afa2919f04efe3eed4ecac9d10913e8a74440 (patch)
treefba1a20d156da5bc8595f188bf93d7b8b367813b
parent423723a84218d48ee95ead1441e9736a58a20c23 (diff)
Removal of redundant RepositoryStore mock
There are two mock implementation of the same interface in the code. One of them could be replaced with another. That is why we remove one to reduce code duplication.
-rw-r--r--internal/praefect/router_per_repository_test.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/internal/praefect/router_per_repository_test.go b/internal/praefect/router_per_repository_test.go
index 02be7775b..d73827682 100644
--- a/internal/praefect/router_per_repository_test.go
+++ b/internal/praefect/router_per_repository_test.go
@@ -35,20 +35,6 @@ func (fn PrimaryGetterFunc) GetPrimary(ctx context.Context, virtualStorage, rela
return fn(ctx, virtualStorage, relativePath)
}
-type MockRepositoryStore struct {
- datastore.RepositoryStore
- GetConsistentSecondariesFunc func(ctx context.Context, virtualStorage, relativePath, primary string) (map[string]struct{}, error)
- IsLatestGenerationFunc func(ctx context.Context, virtualStorage, relativePath, storage string) (bool, error)
-}
-
-func (m MockRepositoryStore) GetConsistentSecondaries(ctx context.Context, virtualStorage, relativePath, primary string) (map[string]struct{}, error) {
- return m.GetConsistentSecondariesFunc(ctx, virtualStorage, relativePath, primary)
-}
-
-func (m MockRepositoryStore) IsLatestGeneration(ctx context.Context, virtualStorage, relativePath, storage string) (bool, error) {
- return m.IsLatestGenerationFunc(ctx, virtualStorage, relativePath, storage)
-}
-
func TestPerRepositoryRouter_RouteStorageAccessor(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
@@ -203,7 +189,7 @@ func TestPerRepositoryRouter_RouteRepositoryAccessor(t *testing.T) {
require.Equal(t, tc.numCandidates, n)
return tc.pickCandidate
}),
- MockRepositoryStore{
+ datastore.MockRepositoryStore{
GetConsistentSecondariesFunc: func(ctx context.Context, virtualStorage, relativePath, primary string) (map[string]struct{}, error) {
t.Helper()
require.Equal(t, tc.virtualStorage, virtualStorage)
@@ -348,7 +334,7 @@ func TestPerRepositoryRouter_RouteRepositoryMutator(t *testing.T) {
}),
tc.healthyNodes,
nil,
- MockRepositoryStore{
+ datastore.MockRepositoryStore{
IsLatestGenerationFunc: func(ctx context.Context, virtualStorage, relativePath, storage string) (bool, error) {
t.Helper()
require.Equal(t, tc.virtualStorage, virtualStorage)