mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
96c0244c04
* Receive redis data with timeout to not hold the connection * Address review comments
31 lines
549 B
Go
31 lines
549 B
Go
package pubsub
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func SetupRedisForTest(t *testing.T) (store *redisQueryResults, teardown func()) {
|
|
var (
|
|
addr = "127.0.0.1:6379"
|
|
password = ""
|
|
database = 0
|
|
useTLS = false
|
|
dupResults = false
|
|
)
|
|
|
|
pool, err := NewRedisPool(addr, password, database, useTLS)
|
|
require.NoError(t, err)
|
|
store = NewRedisQueryResults(pool, dupResults)
|
|
|
|
_, err = store.pool.Get().Do("PING")
|
|
require.Nil(t, err)
|
|
|
|
teardown = func() {
|
|
store.pool.Close()
|
|
}
|
|
|
|
return store, teardown
|
|
}
|