2021-12-01 20:22:15 +08:00
|
|
|
package internal
|
2020-08-20 15:35:13 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"google.golang.org/grpc/resolver"
|
|
|
|
"google.golang.org/grpc/serviceconfig"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNopResolver(t *testing.T) {
|
|
|
|
// make sure ResolveNow & Close don't panic
|
|
|
|
var r nopResolver
|
|
|
|
r.ResolveNow(resolver.ResolveNowOptions{})
|
|
|
|
r.Close()
|
|
|
|
}
|
|
|
|
|
|
|
|
type mockedClientConn struct {
|
|
|
|
state resolver.State
|
2022-10-23 10:54:41 +08:00
|
|
|
err error
|
2020-08-20 15:35:13 +08:00
|
|
|
}
|
|
|
|
|
2021-06-21 09:05:20 +08:00
|
|
|
func (m *mockedClientConn) UpdateState(state resolver.State) error {
|
2020-08-20 15:35:13 +08:00
|
|
|
m.state = state
|
2022-10-23 10:54:41 +08:00
|
|
|
return m.err
|
2020-08-20 15:35:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *mockedClientConn) ReportError(err error) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *mockedClientConn) NewAddress(addresses []resolver.Address) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *mockedClientConn) NewServiceConfig(serviceConfig string) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *mockedClientConn) ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult {
|
|
|
|
return nil
|
|
|
|
}
|