func NewConfig(server string, db string, poolSize int) *Config { return &Config{ "fairway", func(message *Msg) string { return "default" }, []*QueueDefinition{}, &redis.Pool{ MaxIdle: poolSize, MaxActive: 0, IdleTimeout: 240 * time.Second, Dial: func() (redis.Conn, error) { c, err := redis.Dial("tcp", server) if err != nil { return nil, err } c.Do("select", db) return c, err }, TestOnBorrow: func(c redis.Conn, t time.Time) error { _, err := c.Do("PING") return err }, }, } }
func TestAllSpecs(t *testing.T) { r := gospec.NewRunner() r.Parallel = false r.BeforeEach = func() { conn, _ := redis.Dial("tcp", "localhost:6379") conn.Do("select", 15) conn.Do("flushdb") } // List all specs here r.AddSpec(ConfigSpec) r.AddSpec(ConnectionSpec) r.AddSpec(ChanneledConnectionSpec) r.AddSpec(MsgSpec) r.AddSpec(QueueSpec) // Run GoSpec and report any errors to gotest's `testing.T` instance gospec.MainGoTest(r, t) }