Skip to content

Commit 130bc42

Browse files
Improve testutils.MarshalAny (#6617)
1 parent 3156151 commit 130bc42

27 files changed

+648
-632
lines changed

internal/testutils/marshal_any.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@
1818
package testutils
1919

2020
import (
21-
"fmt"
21+
"testing"
2222

2323
"github.com/golang/protobuf/proto"
24-
"github.com/golang/protobuf/ptypes"
24+
"google.golang.org/protobuf/protoadapt"
2525
"google.golang.org/protobuf/types/known/anypb"
2626
)
2727

2828
// MarshalAny is a convenience function to marshal protobuf messages into any
29-
// protos. It will panic if the marshaling fails.
30-
func MarshalAny(m proto.Message) *anypb.Any {
31-
a, err := ptypes.MarshalAny(m)
29+
// protos. function will fail the test with a fatal error if the marshaling fails.
30+
func MarshalAny(t *testing.T, m proto.Message) *anypb.Any {
31+
t.Helper()
32+
33+
a, err := anypb.New(protoadapt.MessageV2Of(m))
3234
if err != nil {
33-
panic(fmt.Sprintf("ptypes.MarshalAny(%+v) failed: %v", m, err))
35+
t.Fatalf("Failed to marshal proto %+v into an Any: %v", m, err)
3436
}
3537
return a
3638
}

internal/testutils/xds/e2e/clientresources.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ import (
2323
"net"
2424
"strconv"
2525

26+
"google.golang.org/protobuf/protoadapt"
27+
2628
"github.com/envoyproxy/go-control-plane/pkg/wellknown"
2729
"github.com/golang/protobuf/proto"
28-
"google.golang.org/grpc/internal/testutils"
2930
"google.golang.org/protobuf/types/known/anypb"
3031

3132
v3clusterpb "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
@@ -106,7 +107,7 @@ var RouterHTTPFilter = HTTPFilter("router", &v3routerpb.Router{})
106107
// DefaultClientListener returns a basic xds Listener resource to be used on
107108
// the client side.
108109
func DefaultClientListener(target, routeName string) *v3listenerpb.Listener {
109-
hcm := testutils.MarshalAny(&v3httppb.HttpConnectionManager{
110+
hcm := marshalAny(&v3httppb.HttpConnectionManager{
110111
RouteSpecifier: &v3httppb.HttpConnectionManager_Rds{Rds: &v3httppb.Rds{
111112
ConfigSource: &v3corepb.ConfigSource{
112113
ConfigSourceSpecifier: &v3corepb.ConfigSource_Ads{Ads: &v3corepb.AggregatedConfigSource{}},
@@ -128,6 +129,14 @@ func DefaultClientListener(target, routeName string) *v3listenerpb.Listener {
128129
}
129130
}
130131

132+
func marshalAny(m proto.Message) *anypb.Any {
133+
a, err := anypb.New(protoadapt.MessageV2Of(m))
134+
if err != nil {
135+
panic(fmt.Sprintf("anypb.New(%+v) failed: %v", m, err))
136+
}
137+
return a
138+
}
139+
131140
// DefaultServerListener returns a basic xds Listener resource to be used on
132141
// the server side.
133142
func DefaultServerListener(host string, port uint32, secLevel SecurityLevel) *v3listenerpb.Listener {
@@ -163,7 +172,7 @@ func DefaultServerListener(host string, port uint32, secLevel SecurityLevel) *v3
163172
ts = &v3corepb.TransportSocket{
164173
Name: "envoy.transport_sockets.tls",
165174
ConfigType: &v3corepb.TransportSocket_TypedConfig{
166-
TypedConfig: testutils.MarshalAny(tlsContext),
175+
TypedConfig: marshalAny(tlsContext),
167176
},
168177
}
169178
}
@@ -205,7 +214,7 @@ func DefaultServerListener(host string, port uint32, secLevel SecurityLevel) *v3
205214
{
206215
Name: "filter-1",
207216
ConfigType: &v3listenerpb.Filter_TypedConfig{
208-
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
217+
TypedConfig: marshalAny(&v3httppb.HttpConnectionManager{
209218
RouteSpecifier: &v3httppb.HttpConnectionManager_RouteConfig{
210219
RouteConfig: &v3routepb.RouteConfiguration{
211220
Name: "routeName",
@@ -253,7 +262,7 @@ func DefaultServerListener(host string, port uint32, secLevel SecurityLevel) *v3
253262
{
254263
Name: "filter-1",
255264
ConfigType: &v3listenerpb.Filter_TypedConfig{
256-
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
265+
TypedConfig: marshalAny(&v3httppb.HttpConnectionManager{
257266
RouteSpecifier: &v3httppb.HttpConnectionManager_RouteConfig{
258267
RouteConfig: &v3routepb.RouteConfiguration{
259268
Name: "routeName",
@@ -285,7 +294,7 @@ func HTTPFilter(name string, config proto.Message) *v3httppb.HttpFilter {
285294
return &v3httppb.HttpFilter{
286295
Name: name,
287296
ConfigType: &v3httppb.HttpFilter_TypedConfig{
288-
TypedConfig: testutils.MarshalAny(config),
297+
TypedConfig: marshalAny(config),
289298
},
290299
}
291300
}
@@ -570,7 +579,7 @@ func ClusterResourceWithOptions(opts ClusterOptions) *v3clusterpb.Cluster {
570579
cluster.ClusterDiscoveryType = &v3clusterpb.Cluster_ClusterType{
571580
ClusterType: &v3clusterpb.Cluster_CustomClusterType{
572581
Name: "envoy.clusters.aggregate",
573-
TypedConfig: testutils.MarshalAny(&v3aggregateclusterpb.ClusterConfig{
582+
TypedConfig: marshalAny(&v3aggregateclusterpb.ClusterConfig{
574583
Clusters: opts.ChildNames,
575584
}),
576585
},
@@ -580,7 +589,7 @@ func ClusterResourceWithOptions(opts ClusterOptions) *v3clusterpb.Cluster {
580589
cluster.TransportSocket = &v3corepb.TransportSocket{
581590
Name: "envoy.transport_sockets.tls",
582591
ConfigType: &v3corepb.TransportSocket_TypedConfig{
583-
TypedConfig: testutils.MarshalAny(tlsContext),
592+
TypedConfig: marshalAny(tlsContext),
584593
},
585594
}
586595
}

internal/xds/rbac/converter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (s) TestBuildLoggerErrors(t *testing.T) {
5151
loggerConfig: &v3rbacpb.RBAC_AuditLoggingOptions_AuditLoggerConfig{
5252
AuditLogger: &v3corepb.TypedExtensionConfig{
5353
Name: "TestAuditLoggerBuffer",
54-
TypedConfig: testutils.MarshalAny(&v3rbacpb.RBAC_AuditLoggingOptions{}),
54+
TypedConfig: testutils.MarshalAny(t, &v3rbacpb.RBAC_AuditLoggingOptions{}),
5555
},
5656
},
5757
expectedError: "custom config not implemented for type ",

test/xds/xds_client_custom_lb_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ import (
5555
// wrrLocality is a helper that takes a proto message and returns a
5656
// WrrLocalityProto with the proto message marshaled into a proto.Any as a
5757
// child.
58-
func wrrLocality(m proto.Message) *v3wrrlocalitypb.WrrLocality {
58+
func wrrLocality(t *testing.T, m proto.Message) *v3wrrlocalitypb.WrrLocality {
5959
return &v3wrrlocalitypb.WrrLocality{
6060
EndpointPickingPolicy: &v3clusterpb.LoadBalancingPolicy{
6161
Policies: []*v3clusterpb.LoadBalancingPolicy_Policy{
6262
{
6363
TypedExtensionConfig: &v3corepb.TypedExtensionConfig{
64-
TypedConfig: testutils.MarshalAny(m),
64+
TypedConfig: testutils.MarshalAny(t, m),
6565
},
6666
},
6767
},
@@ -78,7 +78,7 @@ func clusterWithLBConfiguration(clusterName, edsServiceName string, secLevel e2e
7878
Policies: []*v3clusterpb.LoadBalancingPolicy_Policy{
7979
{
8080
TypedExtensionConfig: &v3corepb.TypedExtensionConfig{
81-
TypedConfig: testutils.MarshalAny(m),
81+
TypedConfig: testutils.MarshalAny(&testing.T{}, m),
8282
},
8383
},
8484
},
@@ -132,7 +132,7 @@ func (s) TestWrrLocality(t *testing.T) {
132132
}{
133133
{
134134
name: "rr_child",
135-
wrrLocalityConfiguration: wrrLocality(&v3roundrobinpb.RoundRobin{}),
135+
wrrLocalityConfiguration: wrrLocality(t, &v3roundrobinpb.RoundRobin{}),
136136
// Each addresses expected probability is locality weight of
137137
// locality / total locality weights multiplied by 1 / number of
138138
// endpoints in each locality (due to round robin across endpoints
@@ -157,7 +157,7 @@ func (s) TestWrrLocality(t *testing.T) {
157157
// (e.g. Address 1 for locality 1, and Address 3 for locality 2).
158158
{
159159
name: "custom_lb_child_pick_first",
160-
wrrLocalityConfiguration: wrrLocality(&v3xdsxdstypepb.TypedStruct{
160+
wrrLocalityConfiguration: wrrLocality(t, &v3xdsxdstypepb.TypedStruct{
161161
TypeUrl: "type.googleapis.com/pick_first",
162162
Value: &structpb.Struct{},
163163
}),
@@ -178,7 +178,7 @@ func (s) TestWrrLocality(t *testing.T) {
178178
// above.
179179
{
180180
name: "custom_lb_child_wrr/",
181-
wrrLocalityConfiguration: wrrLocality(&v3clientsideweightedroundrobinpb.ClientSideWeightedRoundRobin{
181+
wrrLocalityConfiguration: wrrLocality(t, &v3clientsideweightedroundrobinpb.ClientSideWeightedRoundRobin{
182182
EnableOobLoadReport: &wrapperspb.BoolValue{
183183
Value: false,
184184
},
@@ -203,7 +203,7 @@ func (s) TestWrrLocality(t *testing.T) {
203203
},
204204
{
205205
name: "custom_lb_least_request",
206-
wrrLocalityConfiguration: wrrLocality(&v3leastrequestpb.LeastRequest{
206+
wrrLocalityConfiguration: wrrLocality(t, &v3leastrequestpb.LeastRequest{
207207
ChoiceCount: wrapperspb.UInt32(2),
208208
}),
209209
// The test performs a Unary RPC, and blocks until the RPC returns,

test/xds/xds_rls_clusterspecifier_plugin_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import (
4646

4747
// defaultClientResourcesWithRLSCSP returns a set of resources (LDS, RDS, CDS, EDS) for a
4848
// client to connect to a server with a RLS Load Balancer as a child of Cluster Manager.
49-
func defaultClientResourcesWithRLSCSP(lb e2e.LoadBalancingPolicy, params e2e.ResourceParams, rlsProto *rlspb.RouteLookupConfig) e2e.UpdateOptions {
49+
func defaultClientResourcesWithRLSCSP(t *testing.T, lb e2e.LoadBalancingPolicy, params e2e.ResourceParams, rlsProto *rlspb.RouteLookupConfig) e2e.UpdateOptions {
5050
routeConfigName := "route-" + params.DialTarget
5151
clusterName := "cluster-" + params.DialTarget
5252
endpointsName := "endpoints-" + params.DialTarget
@@ -58,7 +58,7 @@ func defaultClientResourcesWithRLSCSP(lb e2e.LoadBalancingPolicy, params e2e.Res
5858
ListenerName: params.DialTarget,
5959
ClusterSpecifierType: e2e.RouteConfigClusterSpecifierTypeClusterSpecifierPlugin,
6060
ClusterSpecifierPluginName: "rls-csp",
61-
ClusterSpecifierPluginConfig: testutils.MarshalAny(&rlspb.RouteLookupClusterSpecifier{
61+
ClusterSpecifierPluginConfig: testutils.MarshalAny(t, &rlspb.RouteLookupClusterSpecifier{
6262
RouteLookupConfig: rlsProto,
6363
}),
6464
})},
@@ -127,7 +127,7 @@ func testRLSinxDS(t *testing.T, lbPolicy e2e.LoadBalancingPolicy) {
127127
}
128128

129129
const serviceName = "my-service-client-side-xds"
130-
resources := defaultClientResourcesWithRLSCSP(lbPolicy, e2e.ResourceParams{
130+
resources := defaultClientResourcesWithRLSCSP(t, lbPolicy, e2e.ResourceParams{
131131
DialTarget: serviceName,
132132
NodeID: nodeID,
133133
Host: "localhost",

test/xds/xds_security_config_nack_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (s) TestUnmarshalListener_WithUpdateValidatorFunc(t *testing.T) {
5353
securityConfig: &v3corepb.TransportSocket{
5454
Name: "envoy.transport_sockets.tls",
5555
ConfigType: &v3corepb.TransportSocket_TypedConfig{
56-
TypedConfig: testutils.MarshalAny(&v3tlspb.DownstreamTlsContext{
56+
TypedConfig: testutils.MarshalAny(t, &v3tlspb.DownstreamTlsContext{
5757
CommonTlsContext: &v3tlspb.CommonTlsContext{
5858
TlsCertificateProviderInstance: &v3tlspb.CertificateProviderPluginInstance{
5959
InstanceName: missingIdentityProviderInstance,
@@ -76,7 +76,7 @@ func (s) TestUnmarshalListener_WithUpdateValidatorFunc(t *testing.T) {
7676
securityConfig: &v3corepb.TransportSocket{
7777
Name: "envoy.transport_sockets.tls",
7878
ConfigType: &v3corepb.TransportSocket_TypedConfig{
79-
TypedConfig: testutils.MarshalAny(&v3tlspb.DownstreamTlsContext{
79+
TypedConfig: testutils.MarshalAny(t, &v3tlspb.DownstreamTlsContext{
8080
CommonTlsContext: &v3tlspb.CommonTlsContext{
8181
TlsCertificateProviderInstance: &v3tlspb.CertificateProviderPluginInstance{
8282
InstanceName: missingIdentityProviderInstance,
@@ -99,7 +99,7 @@ func (s) TestUnmarshalListener_WithUpdateValidatorFunc(t *testing.T) {
9999
securityConfig: &v3corepb.TransportSocket{
100100
Name: "envoy.transport_sockets.tls",
101101
ConfigType: &v3corepb.TransportSocket_TypedConfig{
102-
TypedConfig: testutils.MarshalAny(&v3tlspb.DownstreamTlsContext{
102+
TypedConfig: testutils.MarshalAny(t, &v3tlspb.DownstreamTlsContext{
103103
CommonTlsContext: &v3tlspb.CommonTlsContext{
104104
TlsCertificateProviderInstance: &v3tlspb.CertificateProviderPluginInstance{
105105
InstanceName: e2e.ServerSideCertProviderInstance,
@@ -122,7 +122,7 @@ func (s) TestUnmarshalListener_WithUpdateValidatorFunc(t *testing.T) {
122122
securityConfig: &v3corepb.TransportSocket{
123123
Name: "envoy.transport_sockets.tls",
124124
ConfigType: &v3corepb.TransportSocket_TypedConfig{
125-
TypedConfig: testutils.MarshalAny(&v3tlspb.DownstreamTlsContext{
125+
TypedConfig: testutils.MarshalAny(t, &v3tlspb.DownstreamTlsContext{
126126
CommonTlsContext: &v3tlspb.CommonTlsContext{
127127
TlsCertificateProviderInstance: &v3tlspb.CertificateProviderPluginInstance{
128128
InstanceName: e2e.ServerSideCertProviderInstance,
@@ -227,7 +227,7 @@ func (s) TestUnmarshalCluster_WithUpdateValidatorFunc(t *testing.T) {
227227
securityConfig: &v3corepb.TransportSocket{
228228
Name: "envoy.transport_sockets.tls",
229229
ConfigType: &v3corepb.TransportSocket_TypedConfig{
230-
TypedConfig: testutils.MarshalAny(&v3tlspb.UpstreamTlsContext{
230+
TypedConfig: testutils.MarshalAny(t, &v3tlspb.UpstreamTlsContext{
231231
CommonTlsContext: &v3tlspb.CommonTlsContext{
232232
TlsCertificateProviderInstance: &v3tlspb.CertificateProviderPluginInstance{
233233
InstanceName: missingIdentityProviderInstance,
@@ -250,7 +250,7 @@ func (s) TestUnmarshalCluster_WithUpdateValidatorFunc(t *testing.T) {
250250
securityConfig: &v3corepb.TransportSocket{
251251
Name: "envoy.transport_sockets.tls",
252252
ConfigType: &v3corepb.TransportSocket_TypedConfig{
253-
TypedConfig: testutils.MarshalAny(&v3tlspb.UpstreamTlsContext{
253+
TypedConfig: testutils.MarshalAny(t, &v3tlspb.UpstreamTlsContext{
254254
CommonTlsContext: &v3tlspb.CommonTlsContext{
255255
TlsCertificateProviderInstance: &v3tlspb.CertificateProviderPluginInstance{
256256
InstanceName: missingIdentityProviderInstance,
@@ -273,7 +273,7 @@ func (s) TestUnmarshalCluster_WithUpdateValidatorFunc(t *testing.T) {
273273
securityConfig: &v3corepb.TransportSocket{
274274
Name: "envoy.transport_sockets.tls",
275275
ConfigType: &v3corepb.TransportSocket_TypedConfig{
276-
TypedConfig: testutils.MarshalAny(&v3tlspb.UpstreamTlsContext{
276+
TypedConfig: testutils.MarshalAny(t, &v3tlspb.UpstreamTlsContext{
277277
CommonTlsContext: &v3tlspb.CommonTlsContext{
278278
TlsCertificateProviderInstance: &v3tlspb.CertificateProviderPluginInstance{
279279
InstanceName: e2e.ClientSideCertProviderInstance,
@@ -296,7 +296,7 @@ func (s) TestUnmarshalCluster_WithUpdateValidatorFunc(t *testing.T) {
296296
securityConfig: &v3corepb.TransportSocket{
297297
Name: "envoy.transport_sockets.tls",
298298
ConfigType: &v3corepb.TransportSocket_TypedConfig{
299-
TypedConfig: testutils.MarshalAny(&v3tlspb.UpstreamTlsContext{
299+
TypedConfig: testutils.MarshalAny(t, &v3tlspb.UpstreamTlsContext{
300300
CommonTlsContext: &v3tlspb.CommonTlsContext{
301301
TlsCertificateProviderInstance: &v3tlspb.CertificateProviderPluginInstance{
302302
InstanceName: e2e.ClientSideCertProviderInstance,

test/xds/xds_server_rbac_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (s) TestServerSideXDS_RouteConfiguration(t *testing.T) {
189189
{
190190
Name: "filter-1",
191191
ConfigType: &v3listenerpb.Filter_TypedConfig{
192-
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
192+
TypedConfig: testutils.MarshalAny(t, &v3httppb.HttpConnectionManager{
193193
HttpFilters: []*v3httppb.HttpFilter{e2e.HTTPFilter("router", &v3routerpb.Router{})},
194194
RouteSpecifier: &v3httppb.HttpConnectionManager_RouteConfig{
195195
RouteConfig: &v3routepb.RouteConfiguration{
@@ -227,7 +227,7 @@ func (s) TestServerSideXDS_RouteConfiguration(t *testing.T) {
227227
{
228228
Name: "filter-1",
229229
ConfigType: &v3listenerpb.Filter_TypedConfig{
230-
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
230+
TypedConfig: testutils.MarshalAny(t, &v3httppb.HttpConnectionManager{
231231
HttpFilters: []*v3httppb.HttpFilter{e2e.HTTPFilter("router", &v3routerpb.Router{})},
232232
RouteSpecifier: &v3httppb.HttpConnectionManager_RouteConfig{
233233
RouteConfig: &v3routepb.RouteConfiguration{
@@ -299,7 +299,7 @@ func (s) TestServerSideXDS_RouteConfiguration(t *testing.T) {
299299

300300
// serverListenerWithRBACHTTPFilters returns an xds Listener resource with HTTP Filters defined in the HCM, and a route
301301
// configuration that always matches to a route and a VH.
302-
func serverListenerWithRBACHTTPFilters(host string, port uint32, rbacCfg *rpb.RBAC) *v3listenerpb.Listener {
302+
func serverListenerWithRBACHTTPFilters(t *testing.T, host string, port uint32, rbacCfg *rpb.RBAC) *v3listenerpb.Listener {
303303
// Rather than declare typed config inline, take a HCM proto and append the
304304
// RBAC Filters to it.
305305
hcm := &v3httppb.HttpConnectionManager{
@@ -317,7 +317,7 @@ func serverListenerWithRBACHTTPFilters(host string, port uint32, rbacCfg *rpb.RB
317317
// This tests override parsing + building when RBAC Filter
318318
// passed both normal and override config.
319319
TypedPerFilterConfig: map[string]*anypb.Any{
320-
"rbac": testutils.MarshalAny(&rpb.RBACPerRoute{Rbac: rbacCfg}),
320+
"rbac": testutils.MarshalAny(t, &rpb.RBACPerRoute{Rbac: rbacCfg}),
321321
},
322322
}}},
323323
},
@@ -364,7 +364,7 @@ func serverListenerWithRBACHTTPFilters(host string, port uint32, rbacCfg *rpb.RB
364364
{
365365
Name: "filter-1",
366366
ConfigType: &v3listenerpb.Filter_TypedConfig{
367-
TypedConfig: testutils.MarshalAny(hcm),
367+
TypedConfig: testutils.MarshalAny(t, hcm),
368368
},
369369
},
370370
},
@@ -394,7 +394,7 @@ func serverListenerWithRBACHTTPFilters(host string, port uint32, rbacCfg *rpb.RB
394394
{
395395
Name: "filter-1",
396396
ConfigType: &v3listenerpb.Filter_TypedConfig{
397-
TypedConfig: testutils.MarshalAny(hcm),
397+
TypedConfig: testutils.MarshalAny(t, hcm),
398398
},
399399
},
400400
},
@@ -656,7 +656,7 @@ func (s) TestRBACHTTPFilter(t *testing.T) {
656656
Port: port,
657657
SecLevel: e2e.SecurityLevelNone,
658658
})
659-
inboundLis := serverListenerWithRBACHTTPFilters(host, port, test.rbacCfg)
659+
inboundLis := serverListenerWithRBACHTTPFilters(t, host, port, test.rbacCfg)
660660
resources.Listeners = append(resources.Listeners, inboundLis)
661661

662662
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
@@ -712,7 +712,7 @@ func (s) TestRBACHTTPFilter(t *testing.T) {
712712
// serverListenerWithBadRouteConfiguration returns an xds Listener resource with
713713
// a Route Configuration that will never successfully match in order to test
714714
// RBAC Environment variable being toggled on and off.
715-
func serverListenerWithBadRouteConfiguration(host string, port uint32) *v3listenerpb.Listener {
715+
func serverListenerWithBadRouteConfiguration(t *testing.T, host string, port uint32) *v3listenerpb.Listener {
716716
return &v3listenerpb.Listener{
717717
Name: fmt.Sprintf(e2e.ServerListenerResourceNameTemplate, net.JoinHostPort(host, strconv.Itoa(int(port)))),
718718
Address: &v3corepb.Address{
@@ -751,7 +751,7 @@ func serverListenerWithBadRouteConfiguration(host string, port uint32) *v3listen
751751
{
752752
Name: "filter-1",
753753
ConfigType: &v3listenerpb.Filter_TypedConfig{
754-
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
754+
TypedConfig: testutils.MarshalAny(t, &v3httppb.HttpConnectionManager{
755755
RouteSpecifier: &v3httppb.HttpConnectionManager_RouteConfig{
756756
RouteConfig: &v3routepb.RouteConfiguration{
757757
Name: "routeName",
@@ -799,7 +799,7 @@ func serverListenerWithBadRouteConfiguration(host string, port uint32) *v3listen
799799
{
800800
Name: "filter-1",
801801
ConfigType: &v3listenerpb.Filter_TypedConfig{
802-
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
802+
TypedConfig: testutils.MarshalAny(t, &v3httppb.HttpConnectionManager{
803803
RouteSpecifier: &v3httppb.HttpConnectionManager_RouteConfig{
804804
RouteConfig: &v3routepb.RouteConfiguration{
805805
Name: "routeName",
@@ -858,7 +858,7 @@ func (s) TestRBACToggledOn_WithBadRouteConfiguration(t *testing.T) {
858858
// Since RBAC support is turned ON, all the RPC's should get denied with
859859
// status code Unavailable due to not matching to a route of type Non
860860
// Forwarding Action (Route Table not configured properly).
861-
inboundLis := serverListenerWithBadRouteConfiguration(host, port)
861+
inboundLis := serverListenerWithBadRouteConfiguration(t, host, port)
862862
resources.Listeners = append(resources.Listeners, inboundLis)
863863

864864
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
@@ -915,7 +915,7 @@ func (s) TestRBACToggledOff_WithBadRouteConfiguration(t *testing.T) {
915915
// This bad route configuration shouldn't affect incoming RPC's from
916916
// proceeding as normal, as the configuration shouldn't be parsed due to the
917917
// RBAC Environment variable not being set to true.
918-
inboundLis := serverListenerWithBadRouteConfiguration(host, port)
918+
inboundLis := serverListenerWithBadRouteConfiguration(t, host, port)
919919
resources.Listeners = append(resources.Listeners, inboundLis)
920920

921921
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)

0 commit comments

Comments
 (0)