forked from mirror/redis
fix ut: pool with badconn
This commit is contained in:
parent
78875ecee7
commit
6e0ed33250
22
main_test.go
22
main_test.go
|
@ -12,10 +12,10 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
|
"github.com/go-redis/redis/v8"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -373,14 +373,28 @@ func (e badConnError) Timeout() bool { return true }
|
||||||
func (e badConnError) Temporary() bool { return false }
|
func (e badConnError) Temporary() bool { return false }
|
||||||
|
|
||||||
type badConn struct {
|
type badConn struct {
|
||||||
net.TCPConn
|
|
||||||
|
|
||||||
readDelay, writeDelay time.Duration
|
readDelay, writeDelay time.Duration
|
||||||
readErr, writeErr error
|
readErr, writeErr error
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ net.Conn = &badConn{}
|
var _ net.Conn = &badConn{}
|
||||||
|
|
||||||
|
func (cn *badConn) Close() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cn *badConn) LocalAddr() net.Addr {
|
||||||
|
return &net.TCPAddr{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cn *badConn) RemoteAddr() net.Addr {
|
||||||
|
return &net.TCPAddr{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cn *badConn) SetDeadline(t time.Time) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (cn *badConn) SetReadDeadline(t time.Time) error {
|
func (cn *badConn) SetReadDeadline(t time.Time) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue