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
path: root/cmd
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2021-08-19 15:35:20 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-08-19 15:35:20 +0300
commita4cc03f350f66527198044e1627b8ef9e1797551 (patch)
treebffb9b5ddbc3d310a4c15a2413baf140ceaee0bc /cmd
parenta78f3b9b83031cab7c64ac072c3ac5cf24a79e9d (diff)
test: Remove redundant wrapper around glsql.GetDB
Previously the wrapper was used to omit repetition of the same database name in the package. As now we create a new database on each call of the glsql.GetDB with unique autogenerated name the wrapper is redundant.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/praefect/subcmd_accept_dataloss_test.go3
-rw-r--r--cmd/praefect/subcmd_dataloss_test.go6
-rw-r--r--cmd/praefect/subcmd_set_replication_factor_test.go3
3 files changed, 5 insertions, 7 deletions
diff --git a/cmd/praefect/subcmd_accept_dataloss_test.go b/cmd/praefect/subcmd_accept_dataloss_test.go
index c6682f98c..7316d599c 100644
--- a/cmd/praefect/subcmd_accept_dataloss_test.go
+++ b/cmd/praefect/subcmd_accept_dataloss_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/config"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore/glsql"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/service/info"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
@@ -34,7 +35,7 @@ func TestAcceptDatalossSubcommand(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- db := getDB(t)
+ db := glsql.GetDB(t)
rs := datastore.NewPostgresRepositoryStore(db, conf.StorageNames())
startingGenerations := map[string]int{st1: 1, st2: 0, st3: datastore.GenerationUnknown}
diff --git a/cmd/praefect/subcmd_dataloss_test.go b/cmd/praefect/subcmd_dataloss_test.go
index 13f3b7554..6f033dcef 100644
--- a/cmd/praefect/subcmd_dataloss_test.go
+++ b/cmd/praefect/subcmd_dataloss_test.go
@@ -14,10 +14,6 @@ import (
"google.golang.org/grpc"
)
-func getDB(t *testing.T) glsql.DB {
- return glsql.GetDB(t)
-}
-
func registerPraefectInfoServer(impl gitalypb.PraefectInfoServiceServer) svcRegistrar {
return func(srv *grpc.Server) {
gitalypb.RegisterPraefectInfoServiceServer(srv, impl)
@@ -44,7 +40,7 @@ func TestDatalossSubcommand(t *testing.T) {
},
}
- tx := getDB(t).Begin(t)
+ tx := glsql.GetDB(t).Begin(t)
defer tx.Rollback(t)
ctx, cancel := testhelper.Context()
diff --git a/cmd/praefect/subcmd_set_replication_factor_test.go b/cmd/praefect/subcmd_set_replication_factor_test.go
index 8e532d2c1..8a8139f28 100644
--- a/cmd/praefect/subcmd_set_replication_factor_test.go
+++ b/cmd/praefect/subcmd_set_replication_factor_test.go
@@ -8,6 +8,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/config"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore/glsql"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/service/info"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
@@ -16,7 +17,7 @@ import (
)
func TestSetReplicationFactorSubcommand(t *testing.T) {
- db := getDB(t)
+ db := glsql.GetDB(t)
for _, tc := range []struct {
desc string