test

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MemcacheClient added in v0.2.0

func MemcacheClient() *gom.Client

MemcacheClient created memcached client.

func NewProviderMock

func NewProviderMock(t *testing.T, opts ...OptionMock) cache.Provider

NewProviderMock create new mock provider.

func PebbleDB added in v0.2.1

func PebbleDB() (*pebble.DB, func())

PebbleDB creates pebble DB.

func RedisClient

func RedisClient() func(ctx context.Context) (redis.Conn, error)

RedisClient created redis client.

func RistrettoClient added in v0.2.0

func RistrettoClient() *ristretto.Cache

RistrettoClient creates ristretto client.

func RunSute

func RunSute(t *testing.T, provider cache.Provider, opts ...Option)

RunSute run test by provider.

Types

type Option

type Option func(*ProviderSuite)

Option configure sute.

func WithExpire

func WithExpire(err error) Option

WithExpire sets expired errors.

func WithWaitGet added in v0.2.0

func WithWaitGet(f func()) Option

type OptionMock

type OptionMock func(*ProviderMock)

OptionMock configure mock.

func WithDelete

func WithDelete(f func(t *testing.T) func(ctx context.Context, item *cache.Item) error) OptionMock

WithDelete sets delete method.

func WithGet

func WithGet(f func(t *testing.T) func(ctx context.Context, item *cache.Item) error) OptionMock

WithGet sets get method.

func WithSet

func WithSet(f func(t *testing.T) func(ctx context.Context, item *cache.Item) error) OptionMock

WithSet sets set method.

type ProviderMock

type ProviderMock struct {
	// contains filtered or unexported fields
}

ProviderMock mock.

type ProviderSuite

type ProviderSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

ProviderSuite for testing providers.

func (*ProviderSuite) TestCacheMiss

func (s *ProviderSuite) TestCacheMiss()

TestCacheMiss tested cache miss error.

func (*ProviderSuite) TestDelete

func (s *ProviderSuite) TestDelete()

TestDelete tested delete method.

func (*ProviderSuite) TestExpired

func (s *ProviderSuite) TestExpired()

TestExpired tested error expired.

func (*ProviderSuite) TestGet

func (s *ProviderSuite) TestGet()

TestGet tested get.

func (*ProviderSuite) TestTTL

func (s *ProviderSuite) TestTTL()

TestTTL tested set ttl.

type User

type User struct {
	ID        int
	Name      string
	UpdateAt  time.Time
	CreatedAt time.Time
}

User tested user data.

func NewUser

func NewUser(id int) User

NewUser create mocks data user.

Jump to

Keyboard shortcuts

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