diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2020-09-15 19:35:00 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2020-10-21 15:08:44 +0300 |
commit | 82e1a04c39778072ea2d65af39e28cad92e56dfd (patch) | |
tree | 9ba94d9a38c99b40fe0d3251cd065ca3a62c5c0c | |
parent | 079aff93bb8f6bb525db23b4b20516cf428e1f91 (diff) |
-rw-r--r-- | internal/praefect/auth_test.go | 11 | ||||
-rw-r--r-- | internal/praefect/mock/mock.pb.go | 326 | ||||
-rw-r--r-- | internal/praefect/mock/mock.proto | 17 |
3 files changed, 151 insertions, 203 deletions
diff --git a/internal/praefect/auth_test.go b/internal/praefect/auth_test.go index 27d19de5d..9d9989f23 100644 --- a/internal/praefect/auth_test.go +++ b/internal/praefect/auth_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" gitalyauth "gitlab.com/gitlab-org/gitaly/auth" @@ -61,9 +62,7 @@ func TestAuthFailures(t *testing.T) { cli := mock.NewSimpleServiceClient(conn) - _, err = cli.ServerAccessor(ctx, &mock.SimpleRequest{ - Value: 1, - }) + _, err = cli.RepoAccessorUnary(ctx, &mock.RepoRequest{}) testhelper.RequireGrpcError(t, err, tc.code) }) @@ -135,10 +134,8 @@ func dial(serverSocketPath string, opts []grpc.DialOption) (*grpc.ClientConn, er func runServer(t *testing.T, token string, required bool) (*grpc.Server, string, func()) { backendToken := "abcxyz" mockServer := &mockSvc{ - serverAccessor: func(_ context.Context, req *mock.SimpleRequest) (*mock.SimpleResponse, error) { - return &mock.SimpleResponse{ - Value: req.Value + 1, - }, nil + repoAccessorUnary: func(_ context.Context, req *mock.RepoRequest) (*empty.Empty, error) { + return &empty.Empty{}, nil }, } backend, cleanup := newMockDownstream(t, backendToken, mockServer) diff --git a/internal/praefect/mock/mock.pb.go b/internal/praefect/mock/mock.pb.go index 6f66b292b..7ad3c1285 100644 --- a/internal/praefect/mock/mock.pb.go +++ b/internal/praefect/mock/mock.pb.go @@ -1,12 +1,20 @@ +// +//This file is a mock gRPC service used for validating the various types of +//gRPC methods that Praefect is expected to reverse proxy. It is intended to keep +//tests simple and keep Praefect decoupled from specific gRPC services. + // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.12.4 // source: mock.proto package mock import ( context "context" - fmt "fmt" - math "math" + reflect "reflect" + sync "sync" proto "github.com/golang/protobuf/proto" empty "github.com/golang/protobuf/ptypes/empty" @@ -14,180 +22,174 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type SimpleRequest struct { - Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 -func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } -func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } -func (*SimpleRequest) ProtoMessage() {} -func (*SimpleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6fa4806c90f7156d, []int{0} -} +type RepoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) -} -func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) -} -func (m *SimpleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleRequest.Merge(m, src) -} -func (m *SimpleRequest) XXX_Size() int { - return xxx_messageInfo_SimpleRequest.Size(m) -} -func (m *SimpleRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SimpleRequest.DiscardUnknown(m) + Repo *gitalypb.Repository `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"` } -var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo - -func (m *SimpleRequest) GetValue() int32 { - if m != nil { - return m.Value +func (x *RepoRequest) Reset() { + *x = RepoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mock_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -type SimpleResponse struct { - Value int32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *RepoRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } -func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } -func (*SimpleResponse) ProtoMessage() {} -func (*SimpleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6fa4806c90f7156d, []int{1} -} +func (*RepoRequest) ProtoMessage() {} -func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) -} -func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) -} -func (m *SimpleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleResponse.Merge(m, src) -} -func (m *SimpleResponse) XXX_Size() int { - return xxx_messageInfo_SimpleResponse.Size(m) -} -func (m *SimpleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SimpleResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo - -func (m *SimpleResponse) GetValue() int32 { - if m != nil { - return m.Value +func (x *RepoRequest) ProtoReflect() protoreflect.Message { + mi := &file_mock_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return 0 -} - -type RepoRequest struct { - Repo *gitalypb.Repository `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + return mi.MessageOf(x) } -func (m *RepoRequest) Reset() { *m = RepoRequest{} } -func (m *RepoRequest) String() string { return proto.CompactTextString(m) } -func (*RepoRequest) ProtoMessage() {} +// Deprecated: Use RepoRequest.ProtoReflect.Descriptor instead. func (*RepoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6fa4806c90f7156d, []int{2} -} - -func (m *RepoRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RepoRequest.Unmarshal(m, b) -} -func (m *RepoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RepoRequest.Marshal(b, m, deterministic) -} -func (m *RepoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RepoRequest.Merge(m, src) -} -func (m *RepoRequest) XXX_Size() int { - return xxx_messageInfo_RepoRequest.Size(m) + return file_mock_proto_rawDescGZIP(), []int{0} } -func (m *RepoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RepoRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RepoRequest proto.InternalMessageInfo -func (m *RepoRequest) GetRepo() *gitalypb.Repository { - if m != nil { - return m.Repo +func (x *RepoRequest) GetRepo() *gitalypb.Repository { + if x != nil { + return x.Repo } return nil } -func init() { - proto.RegisterType((*SimpleRequest)(nil), "mock.SimpleRequest") - proto.RegisterType((*SimpleResponse)(nil), "mock.SimpleResponse") - proto.RegisterType((*RepoRequest)(nil), "mock.RepoRequest") -} +var File_mock_proto protoreflect.FileDescriptor + +var file_mock_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x6d, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x6d, 0x6f, + 0x63, 0x6b, 0x1a, 0x0a, 0x6c, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x0b, 0x52, 0x65, 0x70, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x72, 0x65, 0x70, 0x6f, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x04, 0x98, 0xc6, 0x2c, 0x01, + 0x52, 0x04, 0x72, 0x65, 0x70, 0x6f, 0x32, 0x9e, 0x01, 0x0a, 0x0d, 0x53, 0x69, 0x6d, 0x70, 0x6c, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x11, 0x2e, + 0x6d, 0x6f, 0x63, 0x6b, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x02, + 0x12, 0x45, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6f, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x6f, 0x72, 0x55, + 0x6e, 0x61, 0x72, 0x79, 0x12, 0x11, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x2e, 0x52, 0x65, 0x70, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, + 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_mock_proto_rawDescOnce sync.Once + file_mock_proto_rawDescData = file_mock_proto_rawDesc +) -func init() { proto.RegisterFile("mock.proto", fileDescriptor_6fa4806c90f7156d) } - -var fileDescriptor_6fa4806c90f7156d = []byte{ - // 279 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x90, 0x41, 0x4a, 0xc3, 0x40, - 0x14, 0x86, 0x99, 0x90, 0x96, 0xf0, 0xaa, 0xa5, 0x1d, 0x8b, 0x48, 0xdc, 0x48, 0x40, 0xc9, 0xa2, - 0x4c, 0xa1, 0x2e, 0x5d, 0x29, 0xc4, 0x9d, 0x9b, 0x14, 0x0f, 0x90, 0xc6, 0x67, 0x0c, 0x26, 0x7d, - 0xe3, 0xcc, 0xa4, 0x90, 0x93, 0xd4, 0x13, 0x79, 0x13, 0x2f, 0xd1, 0x95, 0x4c, 0x86, 0x60, 0xbb, - 0xed, 0xee, 0xbd, 0x7f, 0xbe, 0xf9, 0xe7, 0x9f, 0x1f, 0xa0, 0xa6, 0xfc, 0x53, 0x48, 0x45, 0x86, - 0xb8, 0x6f, 0xe7, 0xf0, 0x4c, 0x7f, 0x64, 0x0a, 0xdf, 0x9c, 0x16, 0x5e, 0x17, 0x44, 0x45, 0x85, - 0x8b, 0x6e, 0x5b, 0x37, 0xef, 0x0b, 0xac, 0xa5, 0x69, 0xdd, 0x61, 0x74, 0x0b, 0xe7, 0xab, 0xb2, - 0x96, 0x15, 0xa6, 0xf8, 0xd5, 0xa0, 0x36, 0x7c, 0x06, 0x83, 0x6d, 0x56, 0x35, 0x78, 0xc5, 0x6e, - 0x58, 0x3c, 0x48, 0xdd, 0x12, 0xdd, 0xc1, 0xb8, 0xc7, 0xb4, 0xa4, 0x8d, 0xc6, 0x7f, 0xce, 0x3b, - 0xe4, 0x1e, 0x60, 0x94, 0xa2, 0xa4, 0xde, 0x6c, 0x0e, 0xbe, 0x42, 0x49, 0x9d, 0xd7, 0x68, 0xc9, - 0x45, 0x51, 0x9a, 0xac, 0x6a, 0x85, 0x45, 0x74, 0x69, 0x48, 0xb5, 0x4f, 0xfe, 0xf7, 0xcf, 0x9c, - 0xa5, 0x1d, 0xb5, 0xfc, 0x65, 0x7d, 0x98, 0x15, 0xaa, 0x6d, 0x99, 0x23, 0x4f, 0x60, 0x6c, 0x47, - 0x54, 0x8f, 0x79, 0x8e, 0x5a, 0x93, 0xe2, 0x17, 0xa2, 0xfb, 0xed, 0x51, 0xe6, 0x70, 0x76, 0x2c, - 0xba, 0x84, 0x51, 0xb0, 0xdf, 0xc5, 0x7e, 0xe0, 0x4d, 0x18, 0x7f, 0x86, 0xa9, 0x7d, 0xb2, 0x37, - 0x79, 0xdd, 0x64, 0xaa, 0xe5, 0x53, 0x77, 0xe9, 0x20, 0x6e, 0x78, 0x29, 0x5c, 0x55, 0xa2, 0xaf, - 0x4a, 0x24, 0xb6, 0xaa, 0x68, 0xb8, 0xdf, 0xc5, 0x5e, 0xe0, 0xf1, 0x04, 0x26, 0x16, 0x7f, 0x69, - 0x4c, 0x66, 0x4e, 0xb6, 0x61, 0xeb, 0x61, 0xa7, 0xdf, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x6a, - 0x35, 0x84, 0xac, 0xb9, 0x01, 0x00, 0x00, +func file_mock_proto_rawDescGZIP() []byte { + file_mock_proto_rawDescOnce.Do(func() { + file_mock_proto_rawDescData = protoimpl.X.CompressGZIP(file_mock_proto_rawDescData) + }) + return file_mock_proto_rawDescData +} + +var file_mock_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_mock_proto_goTypes = []interface{}{ + (*RepoRequest)(nil), // 0: mock.RepoRequest + (*gitalypb.Repository)(nil), // 1: gitaly.Repository + (*empty.Empty)(nil), // 2: google.protobuf.Empty +} +var file_mock_proto_depIdxs = []int32{ + 1, // 0: mock.RepoRequest.repo:type_name -> gitaly.Repository + 0, // 1: mock.SimpleService.RepoAccessorUnary:input_type -> mock.RepoRequest + 0, // 2: mock.SimpleService.RepoMutatorUnary:input_type -> mock.RepoRequest + 2, // 3: mock.SimpleService.RepoAccessorUnary:output_type -> google.protobuf.Empty + 2, // 4: mock.SimpleService.RepoMutatorUnary:output_type -> google.protobuf.Empty + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_mock_proto_init() } +func file_mock_proto_init() { + if File_mock_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_mock_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_mock_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_mock_proto_goTypes, + DependencyIndexes: file_mock_proto_depIdxs, + MessageInfos: file_mock_proto_msgTypes, + }.Build() + File_mock_proto = out.File + file_mock_proto_rawDesc = nil + file_mock_proto_goTypes = nil + file_mock_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConn +var _ grpc.ClientConnInterface // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +const _ = grpc.SupportPackageIsVersion6 // SimpleServiceClient is the client API for SimpleService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SimpleServiceClient interface { - // ServerAccessor is a unary RPC that accesses a server - ServerAccessor(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) // RepoAccessorUnary is a unary RPC that accesses a repo RepoAccessorUnary(ctx context.Context, in *RepoRequest, opts ...grpc.CallOption) (*empty.Empty, error) // RepoMutatorUnary is a unary RPC that mutates a repo @@ -195,22 +197,13 @@ type SimpleServiceClient interface { } type simpleServiceClient struct { - cc *grpc.ClientConn + cc grpc.ClientConnInterface } -func NewSimpleServiceClient(cc *grpc.ClientConn) SimpleServiceClient { +func NewSimpleServiceClient(cc grpc.ClientConnInterface) SimpleServiceClient { return &simpleServiceClient{cc} } -func (c *simpleServiceClient) ServerAccessor(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { - out := new(SimpleResponse) - err := c.cc.Invoke(ctx, "/mock.SimpleService/ServerAccessor", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *simpleServiceClient) RepoAccessorUnary(ctx context.Context, in *RepoRequest, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) err := c.cc.Invoke(ctx, "/mock.SimpleService/RepoAccessorUnary", in, out, opts...) @@ -231,8 +224,6 @@ func (c *simpleServiceClient) RepoMutatorUnary(ctx context.Context, in *RepoRequ // SimpleServiceServer is the server API for SimpleService service. type SimpleServiceServer interface { - // ServerAccessor is a unary RPC that accesses a server - ServerAccessor(context.Context, *SimpleRequest) (*SimpleResponse, error) // RepoAccessorUnary is a unary RPC that accesses a repo RepoAccessorUnary(context.Context, *RepoRequest) (*empty.Empty, error) // RepoMutatorUnary is a unary RPC that mutates a repo @@ -243,13 +234,10 @@ type SimpleServiceServer interface { type UnimplementedSimpleServiceServer struct { } -func (*UnimplementedSimpleServiceServer) ServerAccessor(ctx context.Context, req *SimpleRequest) (*SimpleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ServerAccessor not implemented") -} -func (*UnimplementedSimpleServiceServer) RepoAccessorUnary(ctx context.Context, req *RepoRequest) (*empty.Empty, error) { +func (*UnimplementedSimpleServiceServer) RepoAccessorUnary(context.Context, *RepoRequest) (*empty.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method RepoAccessorUnary not implemented") } -func (*UnimplementedSimpleServiceServer) RepoMutatorUnary(ctx context.Context, req *RepoRequest) (*empty.Empty, error) { +func (*UnimplementedSimpleServiceServer) RepoMutatorUnary(context.Context, *RepoRequest) (*empty.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method RepoMutatorUnary not implemented") } @@ -257,24 +245,6 @@ func RegisterSimpleServiceServer(s *grpc.Server, srv SimpleServiceServer) { s.RegisterService(&_SimpleService_serviceDesc, srv) } -func _SimpleService_ServerAccessor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SimpleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SimpleServiceServer).ServerAccessor(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/mock.SimpleService/ServerAccessor", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SimpleServiceServer).ServerAccessor(ctx, req.(*SimpleRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _SimpleService_RepoAccessorUnary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RepoRequest) if err := dec(in); err != nil { @@ -316,10 +286,6 @@ var _SimpleService_serviceDesc = grpc.ServiceDesc{ HandlerType: (*SimpleServiceServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "ServerAccessor", - Handler: _SimpleService_ServerAccessor_Handler, - }, - { MethodName: "RepoAccessorUnary", Handler: _SimpleService_RepoAccessorUnary_Handler, }, diff --git a/internal/praefect/mock/mock.proto b/internal/praefect/mock/mock.proto index 8aa159efa..4886e8779 100644 --- a/internal/praefect/mock/mock.proto +++ b/internal/praefect/mock/mock.proto @@ -7,30 +7,15 @@ syntax = "proto3"; package mock; +import "lint.proto"; import "shared.proto"; import "google/protobuf/empty.proto"; -message SimpleRequest { - int32 value = 1; -} - -message SimpleResponse { - int32 value = 2; -} - message RepoRequest { gitaly.Repository repo = 1 [(gitaly.target_repository)=true]; } service SimpleService { - // ServerAccessor is a unary RPC that accesses a server - rpc ServerAccessor(SimpleRequest) returns (SimpleResponse) { - option (gitaly.op_type) = { - op: ACCESSOR - scope_level: SERVER - }; - } - // RepoAccessorUnary is a unary RPC that accesses a repo rpc RepoAccessorUnary(RepoRequest) returns (google.protobuf.Empty) { option (gitaly.op_type) = { |