summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-10-10 14:45:49 +0100
committerNick Thomas <nick@gitlab.com>2019-10-15 07:44:11 +0100
commit8db304b4919519bca60a5b18ffe9b88dcde845af (patch)
tree9ee542fd8d48408c90a70b934d89e8fb75368a01
parentc88d80fe74a27f6668d1aaa6db0abc6d2cf693e1 (diff)
downloadgitlab-shell-8db304b4919519bca60a5b18ffe9b88dcde845af.tar.gz
Remove some unneeded binaries
-rw-r--r--.gitignore4
-rw-r--r--go/cmd/gitaly-receive-pack/main.go35
-rw-r--r--go/cmd/gitaly-receive-pack/main_test.go59
-rw-r--r--go/cmd/gitaly-upload-archive/main.go35
-rw-r--r--go/cmd/gitaly-upload-archive/main_test.go59
-rw-r--r--go/cmd/gitaly-upload-pack/main.go35
-rw-r--r--go/cmd/gitaly-upload-pack/main_test.go59
7 files changed, 0 insertions, 286 deletions
diff --git a/.gitignore b/.gitignore
index c311c16..1497964 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,6 @@ tmp/*
*.log
/*.log*
authorized_keys.lock
-coverage/
.gitlab_shell_secret
.bundle
tags
@@ -15,7 +14,4 @@ hooks/*.d
/bin/gitlab-shell
/bin/gitlab-shell-authorized-keys-check
/bin/gitlab-shell-authorized-principals-check
-/bin/gitaly-upload-pack
-/bin/gitaly-receive-pack
-/bin/gitaly-upload-archive
/bin/check
diff --git a/go/cmd/gitaly-receive-pack/main.go b/go/cmd/gitaly-receive-pack/main.go
deleted file mode 100644
index 9456873..0000000
--- a/go/cmd/gitaly-receive-pack/main.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package main
-
-import (
- "context"
- "encoding/json"
-
- "gitlab.com/gitlab-org/gitlab-shell/go/internal/handler"
- "gitlab.com/gitlab-org/gitlab-shell/go/internal/logger"
- "google.golang.org/grpc"
-
- pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-)
-
-func init() {
- logger.ProgName = "gitaly-receive-pack"
-}
-
-func main() {
- handler.RunGitalyCommand(func(ctx context.Context, conn *grpc.ClientConn, requestJSON string) (int32, error) {
- request, err := deserialize(requestJSON)
- if err != nil {
- return 1, err
- }
-
- return handler.ReceivePack(ctx, conn, request)
- })
-}
-
-func deserialize(requestJSON string) (*pb.SSHReceivePackRequest, error) {
- var request pb.SSHReceivePackRequest
- if err := json.Unmarshal([]byte(requestJSON), &request); err != nil {
- return nil, err
- }
- return &request, nil
-}
diff --git a/go/cmd/gitaly-receive-pack/main_test.go b/go/cmd/gitaly-receive-pack/main_test.go
deleted file mode 100644
index d2601e1..0000000
--- a/go/cmd/gitaly-receive-pack/main_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package main
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
- pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-)
-
-func Test_deserialize(t *testing.T) {
- tests := []struct {
- name string
- requestJSON string
- want *pb.SSHReceivePackRequest
- wantErr bool
- }{
- {
- name: "empty",
- requestJSON: "",
- want: nil,
- wantErr: true,
- },
- {
- name: "empty_hash",
- requestJSON: "{}",
- want: &pb.SSHReceivePackRequest{},
- wantErr: false,
- },
- {
- name: "nil",
- requestJSON: "null",
- want: &pb.SSHReceivePackRequest{},
- wantErr: false,
- },
- {
- name: "values",
- requestJSON: `{"gl_id": "1234"}`,
- want: &pb.SSHReceivePackRequest{GlId: "1234"},
- wantErr: false,
- },
- {
- name: "invalid_json",
- requestJSON: `{"gl_id": "1234`,
- want: nil,
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- got, err := deserialize(tt.requestJSON)
- require.EqualValues(t, got, tt.want, "Got %+v, wanted %+v", got, tt.want)
- if tt.wantErr {
- require.Error(t, err, "Wanted an error, got %+v", err)
- } else {
- require.NoError(t, err, "Wanted no error, got %+v", err)
- }
- })
- }
-}
diff --git a/go/cmd/gitaly-upload-archive/main.go b/go/cmd/gitaly-upload-archive/main.go
deleted file mode 100644
index f2ae4e0..0000000
--- a/go/cmd/gitaly-upload-archive/main.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package main
-
-import (
- "context"
- "encoding/json"
-
- "gitlab.com/gitlab-org/gitlab-shell/go/internal/handler"
- "gitlab.com/gitlab-org/gitlab-shell/go/internal/logger"
- "google.golang.org/grpc"
-
- pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-)
-
-func init() {
- logger.ProgName = "gitaly-upload-archive"
-}
-
-func main() {
- handler.RunGitalyCommand(func(ctx context.Context, conn *grpc.ClientConn, requestJSON string) (int32, error) {
- request, err := deserialize(requestJSON)
- if err != nil {
- return 1, err
- }
-
- return handler.UploadArchive(ctx, conn, request)
- })
-}
-
-func deserialize(argumentJSON string) (*pb.SSHUploadArchiveRequest, error) {
- var request pb.SSHUploadArchiveRequest
- if err := json.Unmarshal([]byte(argumentJSON), &request); err != nil {
- return nil, err
- }
- return &request, nil
-}
diff --git a/go/cmd/gitaly-upload-archive/main_test.go b/go/cmd/gitaly-upload-archive/main_test.go
deleted file mode 100644
index 0ecaf1c..0000000
--- a/go/cmd/gitaly-upload-archive/main_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package main
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
- pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-)
-
-func Test_deserialize(t *testing.T) {
- tests := []struct {
- name string
- requestJSON string
- want *pb.SSHUploadArchiveRequest
- wantErr bool
- }{
- {
- name: "empty",
- requestJSON: "",
- want: nil,
- wantErr: true,
- },
- {
- name: "empty_hash",
- requestJSON: "{}",
- want: &pb.SSHUploadArchiveRequest{},
- wantErr: false,
- },
- {
- name: "nil",
- requestJSON: "null",
- want: &pb.SSHUploadArchiveRequest{},
- wantErr: false,
- },
- {
- name: "values",
- requestJSON: `{"repository": { "storage_name": "12345"} }`,
- want: &pb.SSHUploadArchiveRequest{Repository: &pb.Repository{StorageName: "12345"}},
- wantErr: false,
- },
- {
- name: "invalid_json",
- requestJSON: `{"gl_id": "1234`,
- want: nil,
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- got, err := deserialize(tt.requestJSON)
- require.EqualValues(t, got, tt.want, "Got %+v, wanted %+v", got, tt.want)
- if tt.wantErr {
- require.Error(t, err, "Wanted an error, got %+v", err)
- } else {
- require.NoError(t, err, "Wanted no error, got %+v", err)
- }
- })
- }
-}
diff --git a/go/cmd/gitaly-upload-pack/main.go b/go/cmd/gitaly-upload-pack/main.go
deleted file mode 100644
index 67adfc8..0000000
--- a/go/cmd/gitaly-upload-pack/main.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package main
-
-import (
- "context"
- "encoding/json"
-
- "gitlab.com/gitlab-org/gitlab-shell/go/internal/handler"
- "gitlab.com/gitlab-org/gitlab-shell/go/internal/logger"
- "google.golang.org/grpc"
-
- pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-)
-
-func init() {
- logger.ProgName = "gitaly-upload-pack"
-}
-
-func main() {
- handler.RunGitalyCommand(func(ctx context.Context, conn *grpc.ClientConn, requestJSON string) (int32, error) {
- request, err := deserialize(requestJSON)
- if err != nil {
- return 1, err
- }
-
- return handler.UploadPack(ctx, conn, request)
- })
-}
-
-func deserialize(requestJSON string) (*pb.SSHUploadPackRequest, error) {
- var request pb.SSHUploadPackRequest
- if err := json.Unmarshal([]byte(requestJSON), &request); err != nil {
- return nil, err
- }
- return &request, nil
-}
diff --git a/go/cmd/gitaly-upload-pack/main_test.go b/go/cmd/gitaly-upload-pack/main_test.go
deleted file mode 100644
index 4fa3e07..0000000
--- a/go/cmd/gitaly-upload-pack/main_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package main
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
- pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-)
-
-func Test_deserialize(t *testing.T) {
- tests := []struct {
- name string
- requestJSON string
- want *pb.SSHUploadPackRequest
- wantErr bool
- }{
- {
- name: "empty",
- requestJSON: "",
- want: nil,
- wantErr: true,
- },
- {
- name: "empty_hash",
- requestJSON: "{}",
- want: &pb.SSHUploadPackRequest{},
- wantErr: false,
- },
- {
- name: "nil",
- requestJSON: "null",
- want: &pb.SSHUploadPackRequest{},
- wantErr: false,
- },
- {
- name: "values",
- requestJSON: `{"repository": { "storage_name": "12345"} }`,
- want: &pb.SSHUploadPackRequest{Repository: &pb.Repository{StorageName: "12345"}},
- wantErr: false,
- },
- {
- name: "invalid_json",
- requestJSON: `{"gl_id": "1234`,
- want: nil,
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- got, err := deserialize(tt.requestJSON)
- require.EqualValues(t, got, tt.want, "Got %+v, wanted %+v", got, tt.want)
- if tt.wantErr {
- require.Error(t, err, "Wanted an error, got %+v", err)
- } else {
- require.NoError(t, err, "Wanted no error, got %+v", err)
- }
- })
- }
-}