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:
authorKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-08-28 09:13:06 +0300
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-08-29 17:29:44 +0300
commit21ca55f5aabc5e0ca340bd3e5ab386538de5d3e0 (patch)
tree6a18567c8df8ef93b715f181734b7d6b09c2b388 /internal/rubyserver
parent0e800401af2d5cb657e77d1bc65a8ba87c0d87b6 (diff)
Migrate CommitService.CommitStats
Diffstat (limited to 'internal/rubyserver')
-rw-r--r--internal/rubyserver/rubyserver_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/internal/rubyserver/rubyserver_test.go b/internal/rubyserver/rubyserver_test.go
index a638c2ee4..fbc9b033a 100644
--- a/internal/rubyserver/rubyserver_test.go
+++ b/internal/rubyserver/rubyserver_test.go
@@ -1,7 +1,15 @@
package rubyserver
import (
+ "context"
"testing"
+
+ "github.com/stretchr/testify/assert"
+
+ pb "gitlab.com/gitlab-org/gitaly-proto/go"
+ "gitlab.com/gitlab-org/gitaly/internal/testhelper"
+
+ "google.golang.org/grpc/codes"
)
func TestStopSafe(t *testing.T) {
@@ -14,3 +22,36 @@ func TestStopSafe(t *testing.T) {
bs.Stop()
}
}
+
+func TestSetHeaders(t *testing.T) {
+ testRepo := testhelper.TestRepository()
+
+ testCases := []struct {
+ repo *pb.Repository
+ errType codes.Code
+ }{
+ {
+ repo: &pb.Repository{StorageName: "foo", RelativePath: "bar.git"},
+ errType: codes.InvalidArgument,
+ },
+ {
+ repo: &pb.Repository{StorageName: testRepo.GetStorageName(), RelativePath: "bar.git"},
+ errType: codes.NotFound,
+ },
+ {
+ repo: testRepo,
+ errType: codes.OK,
+ },
+ }
+
+ for _, tc := range testCases {
+ ctx, err := SetHeaders(context.Background(), tc.repo)
+ if tc.errType != codes.OK {
+ testhelper.AssertGrpcError(t, err, tc.errType, "")
+ assert.Nil(t, ctx)
+ } else {
+ assert.NoError(t, err)
+ assert.NotNil(t, ctx)
+ }
+ }
+}