@@ -319,7 +319,6 @@ func testEndpointForDNS(endpoints []resolver.Endpoint, localityWeight uint32, pa
319319}
320320
321321func (s ) TestBuildClusterImplConfigForDNS (t * testing.T ) {
322-
323322 for _ , tt := range []struct {
324323 name string
325324 endpoints []resolver.Endpoint
@@ -364,21 +363,21 @@ func (s) TestBuildClusterImplConfigForDNS(t *testing.T) {
364363 t .Run (tt .name , func (t * testing.T ) {
365364 gotName , gotConfig , gotEndpoints := buildClusterImplConfigForDNS (newNameGenerator (3 ), tt .endpoints , DiscoveryMechanism {Cluster : testClusterName2 , Type : DiscoveryMechanismTypeLogicalDNS }, tt .xdsLBPolicy )
366365 const wantName = "priority-3"
367- if diff := cmp .Diff (gotName , wantName ); diff != "" {
368- t .Errorf ("buildClusterImplConfigForDNS() diff (-got +want ) %v" , diff )
366+ if diff := cmp .Diff (wantName , gotName ); diff != "" {
367+ t .Errorf ("buildClusterImplConfigForDNS() diff (-want +got ) %v" , diff )
369368 }
370369
371370 wantConfig := & clusterimpl.LBConfig {
372371 Cluster : testClusterName2 ,
373372 ChildPolicy : tt .xdsLBPolicy ,
374373 }
375- if diff := cmp .Diff (gotConfig , wantConfig ); diff != "" {
376- t .Errorf ("buildClusterImplConfigForDNS() diff (-got +want ) %v" , diff )
374+ if diff := cmp .Diff (wantConfig , gotConfig ); diff != "" {
375+ t .Errorf ("buildClusterImplConfigForDNS() diff (-want +got ) %v" , diff )
377376 }
378377
379378 wantEndpoints := []resolver.Endpoint {testEndpointForDNS (tt .endpoints , 1 , []string {wantName , xdsinternal .LocalityString (clients.Locality {})})}
380- if diff := cmp .Diff (gotEndpoints , wantEndpoints , endpointCmpOpts ); diff != "" {
381- t .Errorf ("buildClusterImplConfigForDNS() diff (-got +want ) %v" , diff )
379+ if diff := cmp .Diff (wantEndpoints , gotEndpoints , endpointCmpOpts ); diff != "" {
380+ t .Errorf ("buildClusterImplConfigForDNS() diff (-want +got ) %v" , diff )
382381 }
383382 })
384383 }
@@ -478,14 +477,14 @@ func (s) TestBuildClusterImplConfigForEDS(t *testing.T) {
478477 testEndpointWithAttrs (testEndpoints [3 ][1 ].ResolverEndpoint , 80 , 1 , "priority-2-1" , & testLocalityIDs [3 ]),
479478 }
480479
481- if diff := cmp .Diff (gotNames , wantNames ); diff != "" {
482- t .Errorf ("buildClusterImplConfigForEDS() diff (-got +want ) %v" , diff )
480+ if diff := cmp .Diff (wantNames , gotNames ); diff != "" {
481+ t .Errorf ("buildClusterImplConfigForEDS() diff (-want +got ) %v" , diff )
483482 }
484- if diff := cmp .Diff (gotConfigs , wantConfigs ); diff != "" {
485- t .Errorf ("buildClusterImplConfigForEDS() diff (-got +want ) %v" , diff )
483+ if diff := cmp .Diff (wantConfigs , gotConfigs ); diff != "" {
484+ t .Errorf ("buildClusterImplConfigForEDS() diff (-want +got ) %v" , diff )
486485 }
487- if diff := cmp .Diff (gotEndpoints , wantEndpoints , endpointCmpOpts ); diff != "" {
488- t .Errorf ("buildClusterImplConfigForEDS() diff (-got +want ) %v" , diff )
486+ if diff := cmp .Diff (wantEndpoints , gotEndpoints , endpointCmpOpts ); diff != "" {
487+ t .Errorf ("buildClusterImplConfigForEDS() diff (-want +got ) %v" , diff )
489488 }
490489
491490}
@@ -545,8 +544,8 @@ func (s) TestGroupLocalitiesByPriority(t *testing.T) {
545544 for _ , tt := range tests {
546545 t .Run (tt .name , func (t * testing.T ) {
547546 gotLocalities := groupLocalitiesByPriority (tt .localities )
548- if diff := cmp .Diff (gotLocalities , tt .wantLocalities ); diff != "" {
549- t .Errorf ("groupLocalitiesByPriority() diff(-got +want ) %v" , diff )
547+ if diff := cmp .Diff (tt .wantLocalities , gotLocalities ); diff != "" {
548+ t .Errorf ("groupLocalitiesByPriority() diff(-want +got ) %v" , diff )
550549 }
551550 })
552551 }
@@ -708,11 +707,11 @@ func (s) TestPriorityLocalitiesToClusterImpl(t *testing.T) {
708707 if (err != nil ) != tt .wantErr {
709708 t .Fatalf ("priorityLocalitiesToClusterImpl() error = %v, wantErr %v" , err , tt .wantErr )
710709 }
711- if diff := cmp .Diff (got , tt .wantConfig ); diff != "" {
712- t .Errorf ("localitiesToWeightedTarget() diff (-got +want ) %v" , diff )
710+ if diff := cmp .Diff (tt .wantConfig , got ); diff != "" {
711+ t .Errorf ("localitiesToWeightedTarget() diff (-want +got ) %v" , diff )
713712 }
714- if diff := cmp .Diff (got1 , tt .wantEndpoints , cmp .AllowUnexported (attributes.Attributes {})); diff != "" {
715- t .Errorf ("localitiesToWeightedTarget() diff (-got +want ) %v" , diff )
713+ if diff := cmp .Diff (tt .wantEndpoints , got1 , cmp .AllowUnexported (attributes.Attributes {})); diff != "" {
714+ t .Errorf ("localitiesToWeightedTarget() diff (-want +got ) %v" , diff )
716715 }
717716 })
718717 }
@@ -797,8 +796,8 @@ func (s) TestConvertClusterImplMapToOutlierDetection(t *testing.T) {
797796 for _ , test := range tests {
798797 t .Run (test .name , func (t * testing.T ) {
799798 got := convertClusterImplMapToOutlierDetection (test .ciCfgsMap , test .odCfg )
800- if diff := cmp .Diff (got , test .wantODCfgs ); diff != "" {
801- t .Fatalf ("convertClusterImplMapToOutlierDetection() diff(-got +want ) %v" , diff )
799+ if diff := cmp .Diff (test .wantODCfgs , got ); diff != "" {
800+ t .Fatalf ("convertClusterImplMapToOutlierDetection() diff(-want +got ) %v" , diff )
802801 }
803802 })
804803 }
0 commit comments