Documentation ¶
Overview ¶
Package test provides utilities to test binding implementations and transformers.
Index ¶
- Variables
- func AssertTransformerInvokedOneTime(t *testing.T, m *MockTransformer)
- func MustCreateMockBinaryMessage(e event.Event) binding.Message
- func MustCreateMockStructuredMessage(t testing.TB, e event.Event) binding.Message
- func RunTransformerTests(t *testing.T, ctx context.Context, tests []TransformerTestArgs)
- type MockBinaryMessage
- func (bm *MockBinaryMessage) End(ctx context.Context) error
- func (bm *MockBinaryMessage) Finish(error) error
- func (bm *MockBinaryMessage) GetAttribute(k spec.Kind) (spec.Attribute, interface{})
- func (bm *MockBinaryMessage) GetExtension(name string) interface{}
- func (bm *MockBinaryMessage) ReadBinary(ctx context.Context, b binding.BinaryWriter) error
- func (bm *MockBinaryMessage) ReadEncoding() binding.Encoding
- func (bm *MockBinaryMessage) ReadStructured(context.Context, binding.StructuredWriter) error
- func (bm *MockBinaryMessage) SetAttribute(attribute spec.Attribute, value interface{}) error
- func (bm *MockBinaryMessage) SetData(data io.Reader) (err error)
- func (bm *MockBinaryMessage) SetExtension(name string, value interface{}) error
- func (bm *MockBinaryMessage) Start(ctx context.Context) error
- type MockStructuredMessage
- func (s *MockStructuredMessage) Finish(error) error
- func (s *MockStructuredMessage) ReadBinary(context.Context, binding.BinaryWriter) error
- func (s *MockStructuredMessage) ReadEncoding() binding.Encoding
- func (s *MockStructuredMessage) ReadStructured(ctx context.Context, b binding.StructuredWriter) error
- func (s *MockStructuredMessage) SetStructuredEvent(ctx context.Context, format format.Format, event io.Reader) (err error)
- type MockTransformer
- type TransformerTestArgs
Constants ¶
This section is empty.
Variables ¶
View Source
var UnknownMessage binding.Message = unknownMessage{}
Functions ¶
func AssertTransformerInvokedOneTime ¶
func AssertTransformerInvokedOneTime(t *testing.T, m *MockTransformer)
func MustCreateMockBinaryMessage ¶
MustCreateMockBinaryMessage creates a new MockBinaryMessage starting from an event.Event. Panics in case of error
func MustCreateMockStructuredMessage ¶
MustCreateMockStructuredMessage creates a new MockStructuredMessage starting from an event.Event. Panics in case of error.
func RunTransformerTests ¶
func RunTransformerTests(t *testing.T, ctx context.Context, tests []TransformerTestArgs)
Types ¶
type MockBinaryMessage ¶
type MockBinaryMessage struct { Version spec.Version Metadata map[spec.Attribute]interface{} Extensions map[string]interface{} Body []byte }
MockBinaryMessage implements a binary-mode message as a simple struct. MockBinaryMessage implements both the binding.Message interface and the binding.BinaryWriter
func (*MockBinaryMessage) Finish ¶
func (bm *MockBinaryMessage) Finish(error) error
func (*MockBinaryMessage) GetAttribute ¶
func (bm *MockBinaryMessage) GetAttribute(k spec.Kind) (spec.Attribute, interface{})
func (*MockBinaryMessage) GetExtension ¶
func (bm *MockBinaryMessage) GetExtension(name string) interface{}
func (*MockBinaryMessage) ReadBinary ¶
func (bm *MockBinaryMessage) ReadBinary(ctx context.Context, b binding.BinaryWriter) error
func (*MockBinaryMessage) ReadEncoding ¶
func (bm *MockBinaryMessage) ReadEncoding() binding.Encoding
func (*MockBinaryMessage) ReadStructured ¶
func (bm *MockBinaryMessage) ReadStructured(context.Context, binding.StructuredWriter) error
func (*MockBinaryMessage) SetAttribute ¶
func (bm *MockBinaryMessage) SetAttribute(attribute spec.Attribute, value interface{}) error
func (*MockBinaryMessage) SetData ¶
func (bm *MockBinaryMessage) SetData(data io.Reader) (err error)
func (*MockBinaryMessage) SetExtension ¶
func (bm *MockBinaryMessage) SetExtension(name string, value interface{}) error
type MockStructuredMessage ¶
MockStructuredMessage implements a structured-mode message as a simple struct. MockStructuredMessage implements both the binding.Message interface and the binding.StructuredWriter
func (*MockStructuredMessage) Finish ¶
func (s *MockStructuredMessage) Finish(error) error
func (*MockStructuredMessage) ReadBinary ¶
func (s *MockStructuredMessage) ReadBinary(context.Context, binding.BinaryWriter) error
func (*MockStructuredMessage) ReadEncoding ¶
func (s *MockStructuredMessage) ReadEncoding() binding.Encoding
func (*MockStructuredMessage) ReadStructured ¶
func (s *MockStructuredMessage) ReadStructured(ctx context.Context, b binding.StructuredWriter) error
func (*MockStructuredMessage) SetStructuredEvent ¶
type MockTransformer ¶
type MockTransformer struct {
Invoked int
}
func (*MockTransformer) Transform ¶
func (m *MockTransformer) Transform(binding.MessageMetadataReader, binding.MessageMetadataWriter) error
Click to show internal directories.
Click to hide internal directories.