grpct

package
v0.0.0-...-998a113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(dir, serviceName string, descriptor grpcurl.DescriptorSource) error

func GenerateAll

func GenerateAll(dir string, svcs Services) error

func RunCase

func RunCase(conn *grpc.ClientConn, svcs Services, testcase Case, comp CompareFunc) error

func ShowMethod

func ShowMethod(descriptor grpcurl.DescriptorSource, method string) (string, error)

Types

type Case

type Case struct {
	Name      string      `json:"name"`
	Service   string      `json:"service"`
	Method    string      `json:"method"`
	Headers   []string    `json:"headers"`
	ErrorCode codes.Code  `json:"error_code"`
	Error     string      `json:"error"`
	Request   interface{} `json:"request"`
	Response  interface{} `json:"response"`
}

func LoadTestcase

func LoadTestcase(filename string) (*Case, error)

func (Case) CompareResponse

func (c Case) CompareResponse(data []byte, err *status.Status) error

func (Case) GetRequest

func (c Case) GetRequest() []byte

func (Case) GetResponse

func (c Case) GetResponse() []byte

func (Case) GetServeceName

func (c Case) GetServeceName() string

type CaseSlice

type CaseSlice []Case

func LoadTestcases

func LoadTestcases(dir string) (CaseSlice, error)

func (CaseSlice) Len

func (x CaseSlice) Len() int

func (CaseSlice) Less

func (x CaseSlice) Less(i, j int) bool

func (CaseSlice) Swap

func (x CaseSlice) Swap(i, j int)

type CompareFunc

type CompareFunc func(respStat *status.Status, respData, hopeData []byte) error

type InvokeCb

type InvokeCb func(stat *status.Status, response []byte)

type Services

type Services map[string]grpcurl.DescriptorSource

func LoadProtos

func LoadProtos(protoPath string, importPath []string) (Services, error)

func (Services) Invoke

func (svcs Services) Invoke(conn *grpc.ClientConn, method string, headers []string, reqData []byte, cb InvokeCb) error

send grpc request by json data method = "helloworld.Greeter/SayHello"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL