@@ -808,31 +808,31 @@ func (s) TestMethodConfigDefaultService(t *testing.T) {
808
808
}
809
809
}
810
810
811
- func (s ) TestClientConn_Target (t * testing.T ) {
811
+ func (s ) TestClientConnCanonicalTarget (t * testing.T ) {
812
812
tests := []struct {
813
- name string
814
- addr string
815
- targetWant string
813
+ name string
814
+ addr string
815
+ canonicalTargetWant string
816
816
}{
817
817
{
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" ,
821
821
},
822
822
{
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" ,
826
826
},
827
827
{
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" ,
831
831
},
832
832
{
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" ,
836
836
},
837
837
}
838
838
for _ , test := range tests {
@@ -842,8 +842,11 @@ func (s) TestClientConn_Target(t *testing.T) {
842
842
t .Fatalf ("Dial(%s, _) = _, %v, want _, <nil>" , test .addr , err )
843
843
}
844
844
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 )
847
850
}
848
851
})
849
852
}
0 commit comments