Documentation ¶
Overview ¶
Package brokertest provides common functionality tests all broker implementations must pass. These tests guarantee a broker fits well into the publisher pipeline.
Index ¶
- func TestMultiProducerConsumer(t *testing.T, events, batchSize int, factory BrokerFactory)
- func TestProducerCancelRemovesEvents(t *testing.T, factory BrokerFactory)
- func TestSingleProducerConsumer(t *testing.T, events, batchSize int, factory BrokerFactory)
- type BrokerFactory
- type TestLogger
- func (l *TestLogger) Debug(vs ...interface{})
- func (l *TestLogger) Debugf(format string, v ...interface{})
- func (l *TestLogger) Err(vs ...interface{})
- func (l *TestLogger) Errf(format string, v ...interface{})
- func (l *TestLogger) Info(vs ...interface{})
- func (l *TestLogger) Infof(format string, v ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestMultiProducerConsumer ¶
func TestMultiProducerConsumer( t *testing.T, events, batchSize int, factory BrokerFactory, )
func TestProducerCancelRemovesEvents ¶
func TestProducerCancelRemovesEvents(t *testing.T, factory BrokerFactory)
TestSingleProducerConsumer tests buffered events for a producer getting cancelled will not be consumed anymore. Concurrent producer/consumer pairs might still have active events not yet ACKed (not tested here).
Note: brokers not requiring consumers to ACK a events in order to
return ACKs to the producer are not supported by this test.
func TestSingleProducerConsumer ¶
func TestSingleProducerConsumer( t *testing.T, events, batchSize int, factory BrokerFactory, )
Types ¶
type BrokerFactory ¶
type TestLogger ¶
type TestLogger struct {
// contains filtered or unexported fields
}
func NewTestLogger ¶
func NewTestLogger(t *testing.T) *TestLogger
NewTestLogger creates a new logger interface, logging via t.Log/t.Logf. If `-debug` is given on command line, debug logs will be included. Run tests with `-debug-print`, to print log output to console right away. This guarantees logs are still written if the test logs are not printed due to a panic in the test itself.
Capturing log output using the TestLogger, will make the log output correctly display with test test being run.
func (*TestLogger) Debug ¶
func (l *TestLogger) Debug(vs ...interface{})
func (*TestLogger) Debugf ¶
func (l *TestLogger) Debugf(format string, v ...interface{})
func (*TestLogger) Err ¶
func (l *TestLogger) Err(vs ...interface{})
func (*TestLogger) Errf ¶
func (l *TestLogger) Errf(format string, v ...interface{})
func (*TestLogger) Info ¶
func (l *TestLogger) Info(vs ...interface{})
func (*TestLogger) Infof ¶
func (l *TestLogger) Infof(format string, v ...interface{})