mirror of https://github.com/grpc/grpc-go.git
xds: NACK missing route specifier server side (#4925)
* xds: NACK missing route specifier server side
This commit is contained in:
parent
670c133e56
commit
c105005da2
|
|
@ -206,12 +206,12 @@ type ListenerUpdate struct {
|
||||||
// RouteConfigName is the route configuration name corresponding to the
|
// RouteConfigName is the route configuration name corresponding to the
|
||||||
// target which is being watched through LDS.
|
// target which is being watched through LDS.
|
||||||
//
|
//
|
||||||
// Only one of RouteConfigName and InlineRouteConfig is set.
|
// Exactly one of RouteConfigName and InlineRouteConfig is set.
|
||||||
RouteConfigName string
|
RouteConfigName string
|
||||||
// InlineRouteConfig is the inline route configuration (RDS response)
|
// InlineRouteConfig is the inline route configuration (RDS response)
|
||||||
// returned inside LDS.
|
// returned inside LDS.
|
||||||
//
|
//
|
||||||
// Only one of RouteConfigName and InlineRouteConfig is set.
|
// Exactly one of RouteConfigName and InlineRouteConfig is set.
|
||||||
InlineRouteConfig *RouteConfigUpdate
|
InlineRouteConfig *RouteConfigUpdate
|
||||||
|
|
||||||
// MaxStreamDuration contains the HTTP connection manager's
|
// MaxStreamDuration contains the HTTP connection manager's
|
||||||
|
|
|
||||||
|
|
@ -637,8 +637,7 @@ func processNetworkFilters(filters []*v3listenerpb.Filter) (*FilterChain, error)
|
||||||
}
|
}
|
||||||
filterChain.InlineRouteConfig = &routeU
|
filterChain.InlineRouteConfig = &routeU
|
||||||
case nil:
|
case nil:
|
||||||
// No-op, as no route specifier is a valid configuration on
|
return nil, fmt.Errorf("no RouteSpecifier: %+v", hcm)
|
||||||
// the server side.
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported type %T for RouteSpecifier", hcm.RouteSpecifier)
|
return nil, fmt.Errorf("unsupported type %T for RouteSpecifier", hcm.RouteSpecifier)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -770,6 +770,40 @@ func TestNewFilterChainImpl_Failure_BadRouteUpdate(t *testing.T) {
|
||||||
lis *v3listenerpb.Listener
|
lis *v3listenerpb.Listener
|
||||||
wantErr string
|
wantErr string
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
name: "missing-route-specifier",
|
||||||
|
lis: &v3listenerpb.Listener{
|
||||||
|
FilterChains: []*v3listenerpb.FilterChain{
|
||||||
|
{
|
||||||
|
Name: "filter-chain-1",
|
||||||
|
Filters: []*v3listenerpb.Filter{
|
||||||
|
{
|
||||||
|
Name: "hcm",
|
||||||
|
ConfigType: &v3listenerpb.Filter_TypedConfig{
|
||||||
|
|
||||||
|
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
|
||||||
|
HttpFilters: []*v3httppb.HttpFilter{emptyRouterFilter},
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
DefaultFilterChain: &v3listenerpb.FilterChain{
|
||||||
|
Filters: []*v3listenerpb.Filter{
|
||||||
|
{
|
||||||
|
Name: "hcm",
|
||||||
|
ConfigType: &v3listenerpb.Filter_TypedConfig{
|
||||||
|
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
|
||||||
|
HttpFilters: []*v3httppb.HttpFilter{emptyRouterFilter},
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
wantErr: "no RouteSpecifier",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "not-ads",
|
name: "not-ads",
|
||||||
lis: &v3listenerpb.Listener{
|
lis: &v3listenerpb.Listener{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue