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:
authorJacob Vosmaer (GitLab) <jacob@gitlab.com>2018-07-16 14:24:30 +0300
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2018-07-16 14:24:30 +0300
commit1f709d60188f2fca9b579e1bcc70650e85f2b384 (patch)
treec45e6a57c0031cbfb39e490667e5183e27e87252
parentf23ec20e4bd26a3aeaf45344a1c139bb94825d8c (diff)
Remove implementation of Notifications::PostReceive
-rw-r--r--changelogs/unreleased/remove-postreceive.yml5
-rw-r--r--internal/service/notifications/post_receive.go19
-rw-r--r--internal/service/notifications/post_receive_test.go81
-rw-r--r--internal/service/notifications/server.go10
-rw-r--r--internal/service/register.go2
5 files changed, 5 insertions, 112 deletions
diff --git a/changelogs/unreleased/remove-postreceive.yml b/changelogs/unreleased/remove-postreceive.yml
new file mode 100644
index 000000000..dbd64daa3
--- /dev/null
+++ b/changelogs/unreleased/remove-postreceive.yml
@@ -0,0 +1,5 @@
+---
+title: Remove implementation of Notifications::PostReceive
+merge_request: 806
+author:
+type: removed
diff --git a/internal/service/notifications/post_receive.go b/internal/service/notifications/post_receive.go
deleted file mode 100644
index dbda7492c..000000000
--- a/internal/service/notifications/post_receive.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package notifications
-
-import (
- "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
- pb "gitlab.com/gitlab-org/gitaly-proto/go"
- "gitlab.com/gitlab-org/gitaly/internal/helper"
- "golang.org/x/net/context"
-)
-
-func (s *server) PostReceive(ctx context.Context, in *pb.PostReceiveRequest) (*pb.PostReceiveResponse, error) {
- _, err := helper.GetRepoPath(in.GetRepository())
- if err != nil {
- return nil, err
- }
-
- grpc_logrus.Extract(ctx).Debug("PostReceive")
-
- return &pb.PostReceiveResponse{}, nil
-}
diff --git a/internal/service/notifications/post_receive_test.go b/internal/service/notifications/post_receive_test.go
deleted file mode 100644
index 5e77f9f20..000000000
--- a/internal/service/notifications/post_receive_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package notifications
-
-import (
- "context"
- "net"
- "testing"
- "time"
-
- "gitlab.com/gitlab-org/gitaly/internal/testhelper"
-
- pb "gitlab.com/gitlab-org/gitaly-proto/go"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/reflection"
-)
-
-func TestSuccessfulPostReceive(t *testing.T) {
- server, serverSocketPath := runNotificationsServer(t)
- defer server.Stop()
-
- client, conn := newNotificationsClient(t, serverSocketPath)
- defer conn.Close()
-
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
- defer cleanupFn()
-
- rpcRequest := &pb.PostReceiveRequest{Repository: testRepo}
-
- ctx, cancel := context.WithCancel(context.Background())
- defer cancel()
- _, err := client.PostReceive(ctx, rpcRequest)
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestEmptyPostReceiveRequest(t *testing.T) {
- server, serverSocketPath := runNotificationsServer(t)
- defer server.Stop()
-
- client, conn := newNotificationsClient(t, serverSocketPath)
- defer conn.Close()
- rpcRequest := &pb.PostReceiveRequest{}
-
- ctx, cancel := context.WithCancel(context.Background())
- defer cancel()
- _, err := client.PostReceive(ctx, rpcRequest)
- testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
-}
-
-func runNotificationsServer(t *testing.T) (*grpc.Server, string) {
- server := testhelper.NewTestGrpcServer(t, nil, nil)
-
- serverSocketPath := testhelper.GetTemporaryGitalySocketFileName()
- listener, err := net.Listen("unix", serverSocketPath)
- if err != nil {
- t.Fatal(err)
- }
-
- pb.RegisterNotificationsServer(server, NewServer())
- reflection.Register(server)
-
- go server.Serve(listener)
-
- return server, serverSocketPath
-}
-
-func newNotificationsClient(t *testing.T, serverSocketPath string) (pb.NotificationsClient, *grpc.ClientConn) {
- connOpts := []grpc.DialOption{
- grpc.WithInsecure(),
- grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
- return net.DialTimeout("unix", addr, timeout)
- }),
- }
- conn, err := grpc.Dial(serverSocketPath, connOpts...)
- if err != nil {
- t.Fatal(err)
- }
-
- return pb.NewNotificationsClient(conn), conn
-}
diff --git a/internal/service/notifications/server.go b/internal/service/notifications/server.go
deleted file mode 100644
index ace7cdd07..000000000
--- a/internal/service/notifications/server.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package notifications
-
-import pb "gitlab.com/gitlab-org/gitaly-proto/go"
-
-type server struct{}
-
-// NewServer creates a new instance of a grpc NotificationsServer
-func NewServer() pb.NotificationServiceServer {
- return &server{}
-}
diff --git a/internal/service/register.go b/internal/service/register.go
index 35db56c2e..2e5bba4ce 100644
--- a/internal/service/register.go
+++ b/internal/service/register.go
@@ -8,7 +8,6 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/service/conflicts"
"gitlab.com/gitlab-org/gitaly/internal/service/diff"
"gitlab.com/gitlab-org/gitaly/internal/service/namespace"
- "gitlab.com/gitlab-org/gitaly/internal/service/notifications"
"gitlab.com/gitlab-org/gitaly/internal/service/operations"
"gitlab.com/gitlab-org/gitaly/internal/service/ref"
"gitlab.com/gitlab-org/gitaly/internal/service/remote"
@@ -31,7 +30,6 @@ func RegisterAll(grpcServer *grpc.Server, rubyServer *rubyserver.Server) {
pb.RegisterCommitServiceServer(grpcServer, commit.NewServer(rubyServer))
pb.RegisterDiffServiceServer(grpcServer, diff.NewServer(rubyServer))
pb.RegisterNamespaceServiceServer(grpcServer, namespace.NewServer())
- pb.RegisterNotificationServiceServer(grpcServer, notifications.NewServer())
pb.RegisterOperationServiceServer(grpcServer, operations.NewServer(rubyServer))
pb.RegisterRefServiceServer(grpcServer, ref.NewServer(rubyServer))
pb.RegisterRepositoryServiceServer(grpcServer, repository.NewServer(rubyServer))