cache: gitoa.ru/go-4devs/cache/test Index | Files

package test

import "gitoa.ru/go-4devs/cache/test"

Index

Package Files

helpers.go provider.go sute.go

func MemcacheClient Uses

func MemcacheClient() *gom.Client

MemcacheClient created memcached client.

func NewProviderMock Uses

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

NewProviderMock create new mock provider.

func PebbleDB Uses

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

PebbleDB creates pebble DB.

func RedisClient Uses

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

RedisClient created redis client.

func RistrettoClient Uses

func RistrettoClient() *ristretto.Cache

RistrettoClient creates ristretto client.

func RunSute Uses

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

RunSute run test by provider.

type Option Uses

type Option func(*ProviderSuite)

Option configure sute.

func WithExpire Uses

func WithExpire(err error) Option

WithExpire sets expired errors.

func WithWaitGet Uses

func WithWaitGet(f func()) Option

type OptionMock Uses

type OptionMock func(*ProviderMock)

OptionMock configure mock.

func WithDelete Uses

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

WithDelete sets delete method.

func WithGet Uses

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

WithGet sets get method.

func WithSet Uses

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

WithSet sets set method.

type ProviderMock Uses

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

ProviderMock mock.

type ProviderSuite Uses

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

ProviderSuite for testing providers.

func (*ProviderSuite) TestCacheMiss Uses

func (s *ProviderSuite) TestCacheMiss()

TestCacheMiss tested cache miss error.

func (*ProviderSuite) TestDelete Uses

func (s *ProviderSuite) TestDelete()

TestDelete tested delete method.

func (*ProviderSuite) TestExpired Uses

func (s *ProviderSuite) TestExpired()

TestExpired tested error expired.

func (*ProviderSuite) TestGet Uses

func (s *ProviderSuite) TestGet()

TestGet tested get.

func (*ProviderSuite) TestTTL Uses

func (s *ProviderSuite) TestTTL()

TestTTL tested set ttl.

type User Uses

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

User tested user data.

func NewUser Uses

func NewUser(id int) User

NewUser create mocks data user.

Package test imports 16 packages (graph). Updated 2020-12-25. Refresh now. Tools for package owners.