func TestConnectToExistingSentinelRedis(t *testing.T) { redis := NewTransport(getRedisSentinelHost(), getRedisMaster(), "input", "ouput") err := redis.Connect() if err != nil { t.Fatal("Expected connection not established.") } redis.Disconnect() }
func TestConnectToNotExistingRedis(t *testing.T) { redis := NewTransport("doesnotexist:6379", "", "input", "ouput") err := redis.Connect() if err == nil { // expect an error log.Debugln("Error: ", err) t.Fatal("Expected connection to fail but it passed.") } }
func TestConnectToExistingSingleRedis(t *testing.T) { redis := NewRedisTransport(getRedisHost(), "", "input", "ouput") err := redis.Connect() if err != nil { t.Fatalf("Expected connection not established.") } redis.Disconnect() }
func TestSendingAndReceiveWithQueueSentinel(t *testing.T) { queueName := fmt.Sprintf("queue:test-%d", time.Now().UnixNano()) redis := NewTransport(getRedisSentinelHost(), getRedisMaster(), queueName, queueName) redis.Connect() log.Debugf("TestSendingAndReceiveWithQueueSingleHost.queueName: %s", queueName) sendAndReceiveWithQueueInternal(t, redis) defer redis.Disconnect() }