Documentation ¶
Index ¶
- type ContainerLogConsumer
- type LogNotification
- type LogWatch
- func (m *LogWatch) AllLogs() []string
- func (m *LogWatch) ConnectContainer(ctx context.Context, container testcontainers.Container, prefix string, ...) error
- func (m *LogWatch) ContainerLogs(name string) []string
- func (m *LogWatch) DisconnectContainer(container testcontainers.Container)
- func (m *LogWatch) Listen() *LogNotification
- func (m *LogWatch) OnMatch(f func(ln *LogNotification))
- func (m *LogWatch) PrintAll()
- func (m *LogWatch) Shutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerLogConsumer ¶
type ContainerLogConsumer struct { Messages []string // contains filtered or unexported fields }
ContainerLogConsumer is a container log lines consumer
func (*ContainerLogConsumer) Accept ¶
func (g *ContainerLogConsumer) Accept(l testcontainers.Log)
Accept accepts the log message from particular container
func (*ContainerLogConsumer) FindMatch ¶
func (g *ContainerLogConsumer) FindMatch(l testcontainers.Log) int
FindMatch check multiple regex patterns for the same string can be checked with one regex, made for readability of user-facing API
type LogNotification ¶
LogNotification notification about log line match for some container
type LogWatch ¶
type LogWatch struct {
// contains filtered or unexported fields
}
LogWatch is a test helper struct to monitor docker container logs for some patterns and push their logs into Loki for further analysis
func NewLogWatch ¶
NewLogWatch creates a new LogWatch instance, with a Loki client
func (*LogWatch) ConnectContainer ¶
func (m *LogWatch) ConnectContainer(ctx context.Context, container testcontainers.Container, prefix string, pushToLoki bool) error
ConnectContainer connects consumer to selected container and starts testcontainers.LogProducer
func (*LogWatch) ContainerLogs ¶
ContainerLogs return all logs for the particular container
func (*LogWatch) DisconnectContainer ¶
func (m *LogWatch) DisconnectContainer(container testcontainers.Container)
DisconnectContainer disconnects the particular container
func (*LogWatch) Listen ¶
func (m *LogWatch) Listen() *LogNotification
Listen listen for the next notification
func (*LogWatch) OnMatch ¶
func (m *LogWatch) OnMatch(f func(ln *LogNotification))
OnMatch calling your testing hook on first match