rlog

package
v0.0.0-...-b79a0d8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Interfaces related to setting up or mocking remote logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HaveRLMock

func HaveRLMock() bool

Return true if RemoteLoggerMocker impl is set

func HaveRLogSetup

func HaveRLogSetup() bool

Return true if RemoteLoggerSetuper impl is set

func SetImpl

func SetImpl(r RemoteLoggerSetuper)

sets the underlying RemoteLoggerSetuper impl for this package

func SetMockImpl

func SetMockImpl(m RemoteLoggerMocker)

sets the underlying RemoteLoggerMocker impl for this package

func Setup

func Setup(endpoint, id string) error

Types

type Fataler

type Fataler interface {
	Fatal(args ...interface{})
}

lets us avoid testing.T

type MockSrvr

type MockSrvr interface {
	//frees resources
	Close()
	//returns port it listens on
	Port() int
	//return true if current state is that the given stage is finished
	CheckFinished(id, stage string) bool
	//returns all log entries as text, format is impl-defined
	Entries(id string) string
	//returns all ids that have been used while adding log entries, macs, ipmi macs
	Ids() []string
	//returns credentials mock server will hand out
	MockCreds(id string) common.Credentials
}

func MockServer

func MockServer(f Fataler, tmpDir string) MockSrvr

func MockServerAt

func MockServerAt(f Fataler, tmpDir, port string) MockSrvr

type RemoteLoggerMocker

type RemoteLoggerMocker interface {
	//Sets up a mock remote logger.
	MockServer(f Fataler, tmpDir string) MockSrvr
	//Like MockServer, but you specify the port
	MockServerAt(f Fataler, tmpDir, port string) MockSrvr
}

Sets up a mock remote log server; used in conjunction with a RemoteLoggerSetuper in tests (generally, but not exclusively, integration tests).

type RemoteLoggerSetuper

type RemoteLoggerSetuper interface {
	Setup(endpoint, id string) error
}

Sets up a remote logger on demand.

Jump to

Keyboard shortcuts

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