From 9e32cee6bc6e3e71b3659127ec88cc704ad5bbe8 Mon Sep 17 00:00:00 2001 From: Zach Reyes Date: Tue, 14 Sep 2021 01:44:47 -0400 Subject: [PATCH] Fix for test --- xds/internal/httpfilter/httpfilter.go | 8 ++++++++ xds/internal/httpfilter/rbac/rbac.go | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xds/internal/httpfilter/httpfilter.go b/xds/internal/httpfilter/httpfilter.go index 3e10e4f34867..a9b49fc47751 100644 --- a/xds/internal/httpfilter/httpfilter.go +++ b/xds/internal/httpfilter/httpfilter.go @@ -23,6 +23,7 @@ package httpfilter import ( "github.com/golang/protobuf/proto" iresolver "google.golang.org/grpc/internal/resolver" + "google.golang.org/grpc/internal/xds/env" ) // FilterConfig represents an opaque data structure holding configuration for a @@ -98,5 +99,12 @@ func Register(b Filter) { // // If no filter is register with typeURL, nil will be returned. func Get(typeURL string) Filter { + // Hardcoded here vs. rbac http filter package because rbac HTTP Filter test + // is in integration test. + if !env.RBACSupport { + if typeURL == "type.googleapis.com/envoy.extensions.filters.http.rbac.v3.RBAC" || typeURL == "type.googleapis.com/envoy.extensions.filters.http.rbac.v3.RBACPerRoute" { + return nil + } + } return m[typeURL] } diff --git a/xds/internal/httpfilter/rbac/rbac.go b/xds/internal/httpfilter/rbac/rbac.go index fec60b2d3cd7..969111b619a4 100644 --- a/xds/internal/httpfilter/rbac/rbac.go +++ b/xds/internal/httpfilter/rbac/rbac.go @@ -28,7 +28,6 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "google.golang.org/grpc/internal/resolver" - "google.golang.org/grpc/internal/xds/env" "google.golang.org/grpc/internal/xds/rbac" "google.golang.org/grpc/xds/internal/httpfilter" "google.golang.org/protobuf/types/known/anypb" @@ -38,9 +37,7 @@ import ( ) func init() { - if env.RBACSupport { - httpfilter.Register(builder{}) - } + httpfilter.Register(builder{}) } type builder struct {