resolver_test.go 729 B

123456789101112131415161718192021222324252627282930313233343536
  1. package resolver
  2. import (
  3. "testing"
  4. "google.golang.org/grpc/resolver"
  5. "google.golang.org/grpc/serviceconfig"
  6. )
  7. func TestNopResolver(t *testing.T) {
  8. // make sure ResolveNow & Close don't panic
  9. var r nopResolver
  10. r.ResolveNow(resolver.ResolveNowOptions{})
  11. r.Close()
  12. }
  13. type mockedClientConn struct {
  14. state resolver.State
  15. }
  16. func (m *mockedClientConn) UpdateState(state resolver.State) {
  17. m.state = state
  18. }
  19. func (m *mockedClientConn) ReportError(err error) {
  20. }
  21. func (m *mockedClientConn) NewAddress(addresses []resolver.Address) {
  22. }
  23. func (m *mockedClientConn) NewServiceConfig(serviceConfig string) {
  24. }
  25. func (m *mockedClientConn) ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult {
  26. return nil
  27. }