MCPcopy
hub / github.com/grpc/grpc-go / TestResolverBuild

Method TestResolverBuild

internal/resolver/dns/dns_resolver_test.go:864–962  ·  view source on GitHub ↗

Tests the DNS resolver builder with different target names.

(t *testing.T)

Source from the content-addressed store, hash-verified

862
863// Tests the DNS resolver builder with different target names.
864func (s) TestResolverBuild(t *testing.T) {
865 tests := []struct {
866 name string
867 target string
868 wantErr string
869 }{
870 {
871 name: "valid url",
872 target: "www.google.com",
873 },
874 {
875 name: "host port",
876 target: "foo.bar:12345",
877 },
878 {
879 name: "ipv4 address with default port",
880 target: "127.0.0.1",
881 },
882 {
883 name: "ipv6 address without brackets and default port",
884 target: "::",
885 },
886 {
887 name: "ipv4 address with non-default port",
888 target: "127.0.0.1:12345",
889 },
890 {
891 name: "localhost ipv6 with brackets",
892 target: "[::1]:80",
893 },
894 {
895 name: "ipv6 address with brackets",
896 target: "[2001:db8:a0b:12f0::1]:21",
897 },
898 {
899 name: "empty host with port",
900 target: ":80",
901 },
902 {
903 name: "ipv6 address with zone",
904 target: "[fe80::1%25lo0]:80",
905 },
906 {
907 name: "url with port",
908 target: "golang.org:http",
909 },
910 {
911 name: "ipv6 address with non integer port",
912 target: "[2001:db8::1]:http",
913 },
914 {
915 name: "address ends with colon",
916 target: "[2001:db8::1]:",
917 wantErr: dnsinternal.ErrEndsWithColon.Error(),
918 },
919 {
920 name: "address contains only a colon",
921 target: ":",

Callers

nothing calls this directly

Calls 7

GetFunction · 0.92
MustParseURLFunction · 0.92
overrideTimeAfterFuncFunction · 0.85
ErrorMethod · 0.65
FatalfMethod · 0.65
BuildMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected