Documentation ¶
Overview ¶
Package transporttest provides implementations of transport.Transport for testing purposes.
Index ¶
- Variables
- type ErrorTransport
- type Payloads
- type RecorderTransport
- func (r *RecorderTransport) CloudMetadata() model.Cloud
- func (r *RecorderTransport) Metadata() (_ model.System, _ model.Process, _ model.Service, labels model.IfaceMap)
- func (r *RecorderTransport) Payloads() Payloads
- func (r *RecorderTransport) ResetPayloads()
- func (r *RecorderTransport) SendProfile(ctx context.Context, metadata io.Reader, profiles ...io.Reader) error
- func (r *RecorderTransport) SendStream(ctx context.Context, stream io.Reader) error
Constants ¶
This section is empty.
Variables ¶
var Discard transport.Transport = ErrorTransport{}
Discard is a transport.Transport which discards all streams, and returns no errors.
Functions ¶
This section is empty.
Types ¶
type ErrorTransport ¶
type ErrorTransport struct {
Error error
}
ErrorTransport is a transport that returns the stored error for each method call.
func (ErrorTransport) SendStream ¶
SendStream discards the stream and returns t.Error.
type Payloads ¶
type Payloads struct { Errors []model.Error Metrics []model.Metrics Spans []model.Span Transactions []model.Transaction Profiles [][]byte }
Payloads holds the recorded payloads.
type RecorderTransport ¶
type RecorderTransport struct {
// contains filtered or unexported fields
}
RecorderTransport implements transport.Transport, recording the streams sent. The streams can be retrieved using the Payloads method.
func NewRecorderTracer ¶
func NewRecorderTracer() (*apm.Tracer, *RecorderTransport)
NewRecorderTracer returns a new apm.Tracer and RecorderTransport, which is set as the tracer's transport.
DEPRECATED. Use apmtest.NewRecordingTracer instead.
func (*RecorderTransport) CloudMetadata ¶
func (r *RecorderTransport) CloudMetadata() model.Cloud
CloudMetadata returns the cloud metadata recorded by the transport. If metadata is yet to be received, this method will panic.
TODO(axw) remove when Metadata returns an exported type containing all metadata.
func (*RecorderTransport) Metadata ¶
func (r *RecorderTransport) Metadata() (_ model.System, _ model.Process, _ model.Service, labels model.IfaceMap)
Metadata returns the metadata recorded by the transport. If metadata is yet to be received, this method will panic.
TODO(axw) introduce an exported type which contains all metadata, and return that. Although we don't guarantee stability for this package this has a high probability of breaking existing external tests, so let's do that in v2.
func (*RecorderTransport) Payloads ¶
func (r *RecorderTransport) Payloads() Payloads
Payloads returns the payloads recorded by SendStream.
func (*RecorderTransport) ResetPayloads ¶
func (r *RecorderTransport) ResetPayloads()
ResetPayloads clears out any recorded payloads.
func (*RecorderTransport) SendProfile ¶
func (r *RecorderTransport) SendProfile(ctx context.Context, metadata io.Reader, profiles ...io.Reader) error
SendProfile records the stream such that it can later be obtained via Payloads.
func (*RecorderTransport) SendStream ¶
SendStream records the stream such that it can later be obtained via Payloads.