testing

package
v4.3.10+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeforeOnce added in v1.1.0

func BeforeOnce(beforeBlock func())

BeforeOnce runs the before each block only once

func CreateClanNameTextIndexInMongo

func CreateClanNameTextIndexInMongo(getTestMongo func() (interfaces.MongoDB, error), gameID string) error

CreateClanNameTextIndexInMongo creates the necessary text index for clan search in mongo

func WaitForFunc added in v1.1.0

func WaitForFunc(timeout int, f func() error) error

WaitForFunc waits for a given function to finish without error or a timeout

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 added in v0.10.0

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
	// 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