@@ -808,31 +808,31 @@ func (s) TestMethodConfigDefaultService(t *testing.T) {
808808 }
809809}
810810
811- func (s ) TestClientConn_Target (t * testing.T ) {
811+ func (s ) TestClientConnCanonicalTarget (t * testing.T ) {
812812 tests := []struct {
813- name string
814- addr string
815- targetWant string
813+ name string
814+ addr string
815+ canonicalTargetWant string
816816 }{
817817 {
818- name : "normal-case" ,
819- addr : "dns://a.server.com/google.com" ,
820- targetWant : "dns://a.server.com/google.com" ,
818+ name : "normal-case" ,
819+ addr : "dns://a.server.com/google.com" ,
820+ canonicalTargetWant : "dns://a.server.com/google.com" ,
821821 },
822822 {
823- name : "canonical-target-not-specified" ,
824- addr : "no.scheme" ,
825- targetWant : "passthrough:///no.scheme" ,
823+ name : "canonical-target-not-specified" ,
824+ addr : "no.scheme" ,
825+ canonicalTargetWant : "passthrough:///no.scheme" ,
826826 },
827827 {
828- name : "canonical-target-nonexistent" ,
829- addr : "nonexist:///non.existent" ,
830- targetWant : "passthrough:///nonexist:///non.existent" ,
828+ name : "canonical-target-nonexistent" ,
829+ addr : "nonexist:///non.existent" ,
830+ canonicalTargetWant : "passthrough:///nonexist:///non.existent" ,
831831 },
832832 {
833- name : "canonical-target-add-colon-slash" ,
834- addr : "dns:hostname:port" ,
835- targetWant : "dns:///hostname:port" ,
833+ name : "canonical-target-add-colon-slash" ,
834+ addr : "dns:hostname:port" ,
835+ canonicalTargetWant : "dns:///hostname:port" ,
836836 },
837837 }
838838 for _ , test := range tests {
@@ -842,8 +842,11 @@ func (s) TestClientConn_Target(t *testing.T) {
842842 t .Fatalf ("Dial(%s, _) = _, %v, want _, <nil>" , test .addr , err )
843843 }
844844 defer cc .Close ()
845- if cc .Target () != test .targetWant {
846- t .Fatalf ("Target() = %s, want %s" , cc .Target (), test .targetWant )
845+ if cc .Target () != test .addr {
846+ t .Fatalf ("Target() = %s, want %s" , cc .Target (), test .addr )
847+ }
848+ if cc .CanonicalTarget () != test .canonicalTargetWant {
849+ t .Fatalf ("CanonicalTarget() = %s, want %s" , cc .CanonicalTarget (), test .canonicalTargetWant )
847850 }
848851 })
849852 }
0 commit comments