test

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisSuite

type RedisSuite struct {
	// Pool is the pool that Redis connections should be pulled from during
	// test.
	Pool *redis.Pool

	suite.Suite
}

RedisSuite is a type to be used during testing that wraps the testify's `suite.Suite` type and gives a *redis.Pool for us to work with as well.

func NewSuite

func NewSuite(pool *redis.Pool) *RedisSuite

NewSuite constructs a suite with the give pool.

func (*RedisSuite) MustDo

func (r *RedisSuite) MustDo(cmd string, args ...interface{}) (reply interface{})

MustDo executes the command on a new Redis connection and panics if there's an error executing it.

func (*RedisSuite) SetupTest

func (s *RedisSuite) SetupTest()

SetupTest implements the SetupTest function and entirely clears Redis of items before each test run to prevent order-related test issues.

func (*RedisSuite) WithRedis

func (s *RedisSuite) WithRedis(fn func(redis.Conn))

WithRedis runs a function and passes it a valid redis.Conn instance. It does so by obtaining the redis.Conn instance from the owned *redis.Pool and then closing once the outer function has returned.

Jump to

Keyboard shortcuts

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