chore: add more tests (#3010)
This commit is contained in:
@@ -72,7 +72,7 @@ type p2cPicker struct {
|
||||
lock sync.Mutex
|
||||
}
|
||||
|
||||
func (p *p2cPicker) Pick(info balancer.PickInfo) (balancer.PickResult, error) {
|
||||
func (p *p2cPicker) Pick(_ balancer.PickInfo) (balancer.PickResult, error) {
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
|
||||
@@ -123,6 +123,15 @@ func TestP2cPicker_Pick(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPickerWithEmptyConns(t *testing.T) {
|
||||
var picker p2cPicker
|
||||
_, err := picker.Pick(balancer.PickInfo{
|
||||
FullMethodName: "/",
|
||||
Ctx: context.Background(),
|
||||
})
|
||||
assert.ErrorIs(t, err, balancer.ErrNoSubConnAvailable)
|
||||
}
|
||||
|
||||
type mockClientConn struct {
|
||||
// add random string member to avoid map key equality.
|
||||
id string
|
||||
|
||||
Reference in New Issue
Block a user