func BenchmarkTcpConnection(b *testing.B) { assert := audit.NewTestingAssertion(b, true) conn, restore := connectDatabase(assert, redis.TcpConnection("", 0)) defer restore() for i := 0; i < b.N; i++ { result, err := conn.Do("ping") assert.Nil(err) assertEqualString(assert, result, 0, "+PONG") } }
func TestTcpConnection(t *testing.T) { assert := audit.NewTestingAssertion(t, true) conn, restore := connectDatabase(assert, redis.TcpConnection("", 0)) defer restore() result, err := conn.Do("echo", "Hello, World!") assert.Nil(err) assertEqualString(assert, result, 0, "Hello, World!") result, err = conn.Do("ping") assert.Nil(err) assertEqualString(assert, result, 0, "+PONG") }