File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
internal/testutils/xds/e2e Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -712,11 +712,7 @@ func EndpointResourceWithOptions(opts EndpointOptions) *v3endpointpb.ClusterLoad
712
712
},
713
713
}
714
714
}
715
- metadata , err := structpb .NewStruct (b .Metadata )
716
- if err != nil {
717
- panic (err )
718
- }
719
- lbEndpoints = append (lbEndpoints , & v3endpointpb.LbEndpoint {
715
+ lbEndpoint := & v3endpointpb.LbEndpoint {
720
716
HostIdentifier : & v3endpointpb.LbEndpoint_Endpoint {Endpoint : & v3endpointpb.Endpoint {
721
717
Address : & v3corepb.Address {Address : & v3corepb.Address_SocketAddress {
722
718
SocketAddress : & v3corepb.SocketAddress {
@@ -729,12 +725,20 @@ func EndpointResourceWithOptions(opts EndpointOptions) *v3endpointpb.ClusterLoad
729
725
}},
730
726
HealthStatus : b .HealthStatus ,
731
727
LoadBalancingWeight : & wrapperspb.UInt32Value {Value : b .Weight },
732
- Metadata : & v3corepb.Metadata {
728
+ }
729
+
730
+ if b .Metadata != nil {
731
+ metadata , err := structpb .NewStruct (b .Metadata )
732
+ if err != nil {
733
+ panic (fmt .Sprintf ("failed to marshal metadata: %v" , err ))
734
+ }
735
+ lbEndpoint .Metadata = & v3corepb.Metadata {
733
736
FilterMetadata : map [string ]* structpb.Struct {
734
737
"envoy.lb" : metadata ,
735
738
},
736
- },
737
- })
739
+ }
740
+ }
741
+ lbEndpoints = append (lbEndpoints , lbEndpoint )
738
742
}
739
743
740
744
l := locality .Locality
You can’t perform that action at this time.
0 commit comments