testing

package
v7.2.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeforeOnce

func BeforeOnce(beforeBlock func())

BeforeOnce runs the before each block only once

func FHTTPMeasure

func FHTTPMeasure(description string, setup func(map[string]interface{}), f func(*httptest.Server, map[string]interface{}), timeout float64) bool

FHTTPMeasure runs the specified specs in an http test

func HTTPMeasure

func HTTPMeasure(description string, setup func(map[string]interface{}), f func(*httptest.Server, map[string]interface{}), timeout float64) bool

HTTPMeasure runs the specified specs in an http test

func HaveLogMessage

func HaveLogMessage(expectedLevel zap.Level, expectedMessage string, expectedFields ...interface{}) types.GomegaMatcher

HaveLogMessage gomega matcher

func XHTTPMeasure

func XHTTPMeasure(description string, setup func(map[string]interface{}), f func(*httptest.Server, map[string]interface{}), timeout float64) bool

XHTTPMeasure runs the specified specs in an http test

Types

type MockKeyValue

type MockKeyValue struct {
	Values map[string]interface{}
}

MockKeyValue store

func NewMockKV

func NewMockKV() *MockKeyValue

NewMockKV is a mock key value store

func (*MockKeyValue) AddBool

func (m *MockKeyValue) AddBool(key string, value bool)

AddBool to the kv

func (*MockKeyValue) AddFloat64

func (m *MockKeyValue) AddFloat64(key string, value float64)

AddFloat64 to the kv

func (*MockKeyValue) AddInt

func (m *MockKeyValue) AddInt(key string, value int)

AddInt to the kv

func (*MockKeyValue) AddInt64

func (m *MockKeyValue) AddInt64(key string, value int64)

AddInt64 to the kv

func (*MockKeyValue) AddMarshaler

func (m *MockKeyValue) AddMarshaler(key string, marshaler zap.LogMarshaler) error

AddMarshaler to the kv

func (*MockKeyValue) AddObject

func (m *MockKeyValue) AddObject(key string, value interface{}) error

AddObject to the kv

func (*MockKeyValue) AddString

func (m *MockKeyValue) AddString(key, value string)

AddString to the kv

func (*MockKeyValue) AddUint

func (m *MockKeyValue) AddUint(key string, value uint)

AddUint to the kv

func (*MockKeyValue) AddUint64

func (m *MockKeyValue) AddUint64(key string, value uint64)

AddUint64 to the kv

func (*MockKeyValue) AddUintptr

func (m *MockKeyValue) AddUintptr(key string, value uintptr)

AddUintptr to the kv

type MockLogger

type MockLogger struct {
	DefaultFields []zap.Field
	Messages      []map[string]interface{}
	Parent        *MockLogger
	WriteToStdOut bool
	// contains filtered or unexported fields
}

MockLogger implements the zap logger interface but stores all the logged messages for inspection

func NewMockLogger

func NewMockLogger(defaultFields ...zap.Field) *MockLogger

NewMockLogger returns a mock logger for tests

func (*MockLogger) Check

func (m *MockLogger) Check(level zap.Level, msg string) *zap.CheckedMessage

Check created a checked message

func (*MockLogger) DFatal

func (m *MockLogger) DFatal(message string, fields ...zap.Field)

DFatal logs

func (*MockLogger) Debug

func (m *MockLogger) Debug(message string, fields ...zap.Field)

Debug debugs

func (*MockLogger) Error

func (m *MockLogger) Error(message string, fields ...zap.Field)

Error logs

func (*MockLogger) Fatal

func (m *MockLogger) Fatal(message string, fields ...zap.Field)

Fatal logs

func (*MockLogger) Info

func (m *MockLogger) Info(message string, fields ...zap.Field)

Info logs

func (*MockLogger) Level

func (m *MockLogger) Level() zap.Level

Level returns the level

func (*MockLogger) Log

func (m *MockLogger) Log(level zap.Level, message string, fields ...zap.Field)

Log logs

func (*MockLogger) Panic

func (m *MockLogger) Panic(message string, fields ...zap.Field)

Panic logs

func (*MockLogger) SetLevel

func (m *MockLogger) SetLevel(level zap.Level)

SetLevel sets the level

func (*MockLogger) StubTime

func (m *MockLogger) StubTime()

StubTime stubs time

func (*MockLogger) Warn

func (m *MockLogger) Warn(message string, fields ...zap.Field)

Warn logs

func (*MockLogger) With

func (m *MockLogger) With(fields ...zap.Field) zap.Logger

With returns a sub-logger

Jump to

Keyboard shortcuts

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