Enable all tests (fix #25)
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package session_clientgrpc
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
jwt "github.com/go-kit/kit/auth/jwt"
|
||||
"github.com/go-kit/kit/endpoint"
|
||||
"github.com/go-kit/kit/log"
|
||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||
context "golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
||||
|
@@ -1,14 +1,17 @@
|
||||
package session_endpoints
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-kit/kit/endpoint"
|
||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||
context "golang.org/x/net/context"
|
||||
oldcontext "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var _ = endpoint.Chain
|
||||
var _ = fmt.Errorf
|
||||
var _ = context.Background
|
||||
|
||||
type StreamEndpoint func(server interface{}, req interface{}) (err error)
|
||||
|
||||
@@ -16,7 +19,7 @@ type Endpoints struct {
|
||||
LoginEndpoint endpoint.Endpoint
|
||||
}
|
||||
|
||||
func (e *Endpoints) Login(ctx context.Context, in *pb.LoginRequest) (*pb.LoginResponse, error) {
|
||||
func (e *Endpoints) Login(ctx oldcontext.Context, in *pb.LoginRequest) (*pb.LoginResponse, error) {
|
||||
out, err := e.LoginEndpoint(ctx, in)
|
||||
if err != nil {
|
||||
return &pb.LoginResponse{ErrMsg: err.Error()}, err
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Code generated by protoc-gen-gogo.
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: services/session/session.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
@@ -14,7 +14,7 @@ It has these top-level messages:
|
||||
*/
|
||||
package session
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
@@ -32,17 +32,17 @@ var _ = math.Inf
|
||||
// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type LoginRequest struct {
|
||||
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
|
||||
Username string `protobuf:"bytes,1,opt,name=username" json:"username,omitempty"`
|
||||
Password string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LoginRequest) Reset() { *m = LoginRequest{} }
|
||||
func (m *LoginRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*LoginRequest) ProtoMessage() {}
|
||||
func (*LoginRequest) Descriptor() ([]byte, []int) { return fileDescriptorSession, []int{0} }
|
||||
func (*LoginRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *LoginRequest) GetUsername() string {
|
||||
if m != nil {
|
||||
@@ -59,14 +59,14 @@ func (m *LoginRequest) GetPassword() string {
|
||||
}
|
||||
|
||||
type LoginResponse struct {
|
||||
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
|
||||
ErrMsg string `protobuf:"bytes,2,opt,name=err_msg,json=errMsg,proto3" json:"err_msg,omitempty"`
|
||||
Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"`
|
||||
ErrMsg string `protobuf:"bytes,2,opt,name=err_msg,json=errMsg" json:"err_msg,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LoginResponse) Reset() { *m = LoginResponse{} }
|
||||
func (m *LoginResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*LoginResponse) ProtoMessage() {}
|
||||
func (*LoginResponse) Descriptor() ([]byte, []int) { return fileDescriptorSession, []int{1} }
|
||||
func (*LoginResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *LoginResponse) GetToken() string {
|
||||
if m != nil {
|
||||
@@ -159,11 +159,11 @@ var _SessionService_serviceDesc = grpc.ServiceDesc{
|
||||
Metadata: "services/session/session.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("services/session/session.proto", fileDescriptorSession) }
|
||||
func init() { proto.RegisterFile("services/session/session.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptorSession = []byte{
|
||||
var fileDescriptor0 = []byte{
|
||||
// 188 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4e, 0x2d, 0x2a,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4e, 0x2d, 0x2a,
|
||||
0xcb, 0x4c, 0x4e, 0x2d, 0xd6, 0x2f, 0x4e, 0x2d, 0x2e, 0xce, 0xcc, 0xcf, 0x83, 0xd1, 0x7a, 0x05,
|
||||
0x45, 0xf9, 0x25, 0xf9, 0x42, 0xec, 0x50, 0xae, 0x92, 0x1b, 0x17, 0x8f, 0x4f, 0x7e, 0x7a, 0x66,
|
||||
0x5e, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x90, 0x14, 0x17, 0x47, 0x69, 0x71, 0x6a, 0x51,
|
||||
|
@@ -1,10 +1,11 @@
|
||||
package session_grpctransport
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"fmt"
|
||||
|
||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||
context "golang.org/x/net/context"
|
||||
oldcontext "golang.org/x/net/context"
|
||||
|
||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||
@@ -14,7 +15,8 @@ import (
|
||||
var _ = fmt.Errorf
|
||||
|
||||
func MakeGRPCServer(ctx context.Context, endpoints endpoints.Endpoints) pb.SessionServiceServer {
|
||||
options := []grpctransport.ServerOption{}
|
||||
var options []grpctransport.ServerOption
|
||||
_ = options
|
||||
return &grpcServer{
|
||||
|
||||
login: grpctransport.NewServer(
|
||||
@@ -31,7 +33,7 @@ type grpcServer struct {
|
||||
login grpctransport.Handler
|
||||
}
|
||||
|
||||
func (s *grpcServer) Login(ctx context.Context, req *pb.LoginRequest) (*pb.LoginResponse, error) {
|
||||
func (s *grpcServer) Login(ctx oldcontext.Context, req *pb.LoginRequest) (*pb.LoginResponse, error) {
|
||||
_, rep, err := s.login.ServeGRPC(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package session_httptransport
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
context "golang.org/x/net/context"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
@@ -12,6 +12,10 @@ import (
|
||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||
)
|
||||
|
||||
var _ = log.Printf
|
||||
var _ = gokit_endpoint.Chain
|
||||
var _ = httptransport.NewClient
|
||||
|
||||
func MakeLoginHandler(ctx context.Context, svc pb.SessionServiceServer, endpoint gokit_endpoint.Endpoint) *httptransport.Server {
|
||||
return httptransport.NewServer(
|
||||
ctx,
|
||||
|
Reference in New Issue
Block a user