Documentation ¶
Index ¶
Constants ¶
View Source
const ( StatusGreen StatusYellow StatusRed StatusUnknown )
statuses
Variables ¶
This section is empty.
Functions ¶
func ConvertStatusString ¶ added in v0.0.4
ConvertStatusString converts a string ("red"/"yellow"/"green") into the status code.
Types ¶
type Check ¶
type Check interface { // Name should return a unique name for this check. Name() string // Check should execute the check and return a list of Results. Check(ctx context.Context) []Result }
Check defines the interface all preflight checks must expose.
type CheckMock ¶
type CheckMock struct { // CheckFunc mocks the Check method. CheckFunc func(ctx context.Context) []Result // NameFunc mocks the Name method. NameFunc func() string // contains filtered or unexported fields }
CheckMock is a mock implementation of Check.
func TestSomethingThatUsesCheck(t *testing.T) { // make and configure a mocked Check mockedCheck := &CheckMock{ CheckFunc: func(ctx context.Context) []Result { panic("mock out the Check method") }, NameFunc: func() string { panic("mock out the Name method") }, } // use mockedCheck in code that requires Check // and then make assertions. }
func (*CheckMock) CheckCalls ¶
CheckCalls gets all the calls that were made to Check. Check the length with:
len(mockedCheck.CheckCalls())
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker executes multiple checks in parallel and returns the list of results.
type Option ¶
type Option func(*options)
Option is a function for customizing the checker.
func WithTimeout ¶
WithTimeout sets the Checker's timeout.
type Result ¶
type Result struct { // Name is the name or short desription of the check. Name string `json:"name"` // Message is a status or error message. Message string `json:"message"` // Status represents the check's state: green/yellow/red. Status int `json:"status"` }
Result represents the result of a check.
Click to show internal directories.
Click to hide internal directories.