testing

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package testing is a generated protocol buffer package.

It is generated from these files:

test.proto

It has these top-level messages:

EchoRequest
EchoResponse

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTestServiceServer

func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer)

Types

type EchoRequest

type EchoRequest struct {
	Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
}

func (*EchoRequest) Descriptor

func (*EchoRequest) Descriptor() ([]byte, []int)

func (*EchoRequest) GetMessage

func (m *EchoRequest) GetMessage() string

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) Reset

func (m *EchoRequest) Reset()

func (*EchoRequest) String

func (m *EchoRequest) String() string

type EchoResponse

type EchoResponse struct {
	Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
}

func (*EchoResponse) Descriptor

func (*EchoResponse) Descriptor() ([]byte, []int)

func (*EchoResponse) GetMessage

func (m *EchoResponse) GetMessage() string

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) Reset

func (m *EchoResponse) Reset()

func (*EchoResponse) String

func (m *EchoResponse) String() string

type FakeNRApp

type FakeNRApp struct {
	newrelic.Application
	Txns []*FakeNRTxn
	// contains filtered or unexported fields
}

FakeNRApp is an impplementation of newrelic.Application for tests.

func NewFakeNRApp

func NewFakeNRApp(t *testing.T) *FakeNRApp

NewFakeNRApp returns a new fake newrelic.Application instnace.

func (*FakeNRApp) CheckTxnCount

func (a *FakeNRApp) CheckTxnCount(c int)

CheckTxnCount fails the test if created transaction count is invalid.

func (*FakeNRApp) StartTransaction

func (a *FakeNRApp) StartTransaction(name string, _ http.ResponseWriter, _ *http.Request) newrelic.Transaction

StartTransaction implements the newrelic.Application interface.

type FakeNRTxn

type FakeNRTxn struct {
	newrelic.Transaction
	Name    string
	Errs    []error
	Ended   bool
	Ignored bool
	Attrs   map[string]interface{}
	// contains filtered or unexported fields
}

FakeNRTxn is an implementation of newrelic.Transaction for tests.

func NewFakeNRTxn

func NewFakeNRTxn(t *testing.T, name string) *FakeNRTxn

NewFakeNRTxn returns a new fake newrelic.Transaction instnace.

func (*FakeNRTxn) AddAttribute

func (t *FakeNRTxn) AddAttribute(k string, v interface{}) error

AddAttribute implements the newrelic.Transaction interface.

func (*FakeNRTxn) CheckEnded

func (t *FakeNRTxn) CheckEnded()

CheckEnded fails the test if the transaction has been ended.

func (*FakeNRTxn) CheckErrorCount

func (t *FakeNRTxn) CheckErrorCount(c int)

CheckErrorCount fails the test if the transaction's error count is invalid.

func (*FakeNRTxn) CheckIgnored

func (t *FakeNRTxn) CheckIgnored(ignored bool)

CheckIgnored fails the test if the transaction's ignored status is invaild.

func (*FakeNRTxn) CheckStatusCode

func (t *FakeNRTxn) CheckStatusCode(c codes.Code)

CheckStatusCode fails the test if the transaction does not has a valid status code.

func (*FakeNRTxn) End

func (t *FakeNRTxn) End() error

End implements the newrelic.Transaction interface.

func (*FakeNRTxn) Ignore

func (t *FakeNRTxn) Ignore() error

Ignore implements the newrelic.Transaction interface.

func (*FakeNRTxn) NoticeError

func (t *FakeNRTxn) NoticeError(err error) error

NoticeError implements the newrelic.Transaction interface.

func (*FakeNRTxn) SetName

func (t *FakeNRTxn) SetName(name string) error

SetName implements the newrelic.Transaction interface.

func (*FakeNRTxn) SetWebRequest

func (t *FakeNRTxn) SetWebRequest(req newrelic.WebRequest) error

SetWebRequest implements the newrelic.Transaction interface.

func (*FakeNRTxn) StartSegmentNow

func (t *FakeNRTxn) StartSegmentNow() newrelic.SegmentStartTime

StartSegmentNow implements the newrelic.Transaction interface.

type TestContext

type TestContext struct {
	ServerOpts []grpc.ServerOption
	ClientOpts []grpc.DialOption

	Service TestServiceServer
	Client  TestServiceClient
	// contains filtered or unexported fields
}

TestContext is a testing helper for generating a gRPC server and a gRPC client.

func CreateTestContext

func CreateTestContext(t *testing.T) *TestContext

CreateTestContext returns a new TestContext object.

func (*TestContext) SetClientStatsHandler

func (c *TestContext) SetClientStatsHandler(h stats.Handler)

SetClientStatsHandler sets stats.Handler to a test client.

func (*TestContext) SetServerStatsHandler

func (c *TestContext) SetServerStatsHandler(h stats.Handler)

SetServerStatsHandler sets stats.Handler to a test server.

func (*TestContext) Setup

func (c *TestContext) Setup()

Setup starts a server and creates a client connection.

func (*TestContext) Teardown

func (c *TestContext) Teardown()

Teardown disconnects a client connection and stops a server

type TestServiceClient

type TestServiceClient interface {
	Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
	Empty(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	Error(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
}

func NewTestServiceClient

func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient

Jump to

Keyboard shortcuts

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