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:
authorJohn Cai <jcai@gitlab.com>2020-07-01 20:22:08 +0300
committerJohn Cai <jcai@gitlab.com>2020-07-01 20:22:08 +0300
commitc5786e04b7bff6fd530c09bbd1459f96e39ca851 (patch)
treeb725a172c2978f1923dd96819ae8def04bfe26d2
parent7d376f93966b45f4b11462fd88a9538b43d2b7a2 (diff)
parent4a529b4193f1b19c0edb2d52b6afd7405405faac (diff)
Merge branch 'pks-linter-fixes' into 'master'
Fixes to linter violations See merge request gitlab-org/gitaly!2335
-rw-r--r--internal/praefect/coordinator.go18
-rw-r--r--internal/praefect/server_test.go26
2 files changed, 13 insertions, 31 deletions
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go
index 4f8f26772..4a0748512 100644
--- a/internal/praefect/coordinator.go
+++ b/internal/praefect/coordinator.go
@@ -158,24 +158,6 @@ func (c *Coordinator) accessorStreamParameters(ctx context.Context, call grpcCal
}, nil, nil, nil), nil
}
-func (c *Coordinator) injectTransaction(ctx context.Context, node nodes.Node, primary bool) (context.Context, func(), error) {
- // We currently only handle single-node-transactions for the primary,
- // so we just blindly call this single node "primary".
- voter := transactions.Voter{Name: "primary"}
-
- transactionID, cancel, err := c.txMgr.RegisterTransaction(ctx, []transactions.Voter{voter})
- if err != nil {
- return nil, nil, err
- }
-
- ctx, err = metadata.InjectTransaction(ctx, transactionID, voter.Name, primary)
- if err != nil {
- return nil, nil, err
- }
-
- return ctx, cancel, nil
-}
-
var transactionRPCs = map[string]struct{}{
"/gitaly.SmartHTTPService/PostReceivePack": {},
"/gitaly.SSHService/SSHReceivePack": {},
diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go
index 73bd2c607..f1f4b717b 100644
--- a/internal/praefect/server_test.go
+++ b/internal/praefect/server_test.go
@@ -647,12 +647,12 @@ func TestRepoRename(t *testing.T) {
defer func() { require.NoError(t, os.RemoveAll(expNewPath2)) }()
}
-type mockSmartHttp struct {
+type mockSmartHTTP struct {
m sync.Mutex
methodsCalled map[string]int
}
-func (m *mockSmartHttp) InfoRefsUploadPack(req *gitalypb.InfoRefsRequest, stream gitalypb.SmartHTTPService_InfoRefsUploadPackServer) error {
+func (m *mockSmartHTTP) InfoRefsUploadPack(req *gitalypb.InfoRefsRequest, stream gitalypb.SmartHTTPService_InfoRefsUploadPackServer) error {
m.m.Lock()
defer m.m.Unlock()
if m.methodsCalled == nil {
@@ -665,7 +665,7 @@ func (m *mockSmartHttp) InfoRefsUploadPack(req *gitalypb.InfoRefsRequest, stream
return nil
}
-func (m *mockSmartHttp) InfoRefsReceivePack(req *gitalypb.InfoRefsRequest, stream gitalypb.SmartHTTPService_InfoRefsReceivePackServer) error {
+func (m *mockSmartHTTP) InfoRefsReceivePack(req *gitalypb.InfoRefsRequest, stream gitalypb.SmartHTTPService_InfoRefsReceivePackServer) error {
m.m.Lock()
defer m.m.Unlock()
if m.methodsCalled == nil {
@@ -678,7 +678,7 @@ func (m *mockSmartHttp) InfoRefsReceivePack(req *gitalypb.InfoRefsRequest, strea
return nil
}
-func (m *mockSmartHttp) PostUploadPack(stream gitalypb.SmartHTTPService_PostUploadPackServer) error {
+func (m *mockSmartHTTP) PostUploadPack(stream gitalypb.SmartHTTPService_PostUploadPackServer) error {
m.m.Lock()
defer m.m.Unlock()
if m.methodsCalled == nil {
@@ -691,7 +691,7 @@ func (m *mockSmartHttp) PostUploadPack(stream gitalypb.SmartHTTPService_PostUplo
return nil
}
-func (m *mockSmartHttp) PostReceivePack(stream gitalypb.SmartHTTPService_PostReceivePackServer) error {
+func (m *mockSmartHTTP) PostReceivePack(stream gitalypb.SmartHTTPService_PostReceivePackServer) error {
m.m.Lock()
defer m.m.Unlock()
if m.methodsCalled == nil {
@@ -719,7 +719,7 @@ func (m *mockSmartHttp) PostReceivePack(stream gitalypb.SmartHTTPService_PostRec
return nil
}
-func (m *mockSmartHttp) Called(method string) int {
+func (m *mockSmartHTTP) Called(method string) int {
m.m.Lock()
defer m.m.Unlock()
@@ -742,13 +742,13 @@ func newGrpcServer(t *testing.T, srv gitalypb.SmartHTTPServiceServer) (string, *
}
func TestProxyWrites(t *testing.T) {
- smartHttp0, smartHttp1, smartHttp2 := &mockSmartHttp{}, &mockSmartHttp{}, &mockSmartHttp{}
+ smartHTTP0, smartHTTP1, smartHTTP2 := &mockSmartHTTP{}, &mockSmartHTTP{}, &mockSmartHTTP{}
- socket0, srv0 := newGrpcServer(t, smartHttp0)
+ socket0, srv0 := newGrpcServer(t, smartHTTP0)
defer srv0.Stop()
- socket1, srv1 := newGrpcServer(t, smartHttp1)
+ socket1, srv1 := newGrpcServer(t, smartHTTP1)
defer srv1.Stop()
- socket2, srv2 := newGrpcServer(t, smartHttp2)
+ socket2, srv2 := newGrpcServer(t, smartHTTP2)
defer srv2.Stop()
conf := config.Config{
@@ -832,9 +832,9 @@ func TestProxyWrites(t *testing.T) {
require.NoError(t, err)
}
- assert.Equal(t, 1, smartHttp0.Called("PostReceivePack"))
- assert.Equal(t, 1, smartHttp1.Called("PostReceivePack"))
- assert.Equal(t, 1, smartHttp2.Called("PostReceivePack"))
+ assert.Equal(t, 1, smartHTTP0.Called("PostReceivePack"))
+ assert.Equal(t, 1, smartHTTP1.Called("PostReceivePack"))
+ assert.Equal(t, 1, smartHTTP2.Called("PostReceivePack"))
assert.Equal(t, bytes.Repeat([]byte(payload), 10), receivedData.Bytes())
}