コード例 #1
0
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()
}
コード例 #2
0
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.")
	}
}
コード例 #3
0
func TestConnectToExistingSingleRedis(t *testing.T) {
	redis := NewRedisTransport(getRedisHost(), "", "input", "ouput")
	err := redis.Connect()
	if err != nil {
		t.Fatalf("Expected connection not established.")
	}
	redis.Disconnect()
}
コード例 #4
0
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()
}