Skip to content

Commit

Permalink
Fix for test
Browse files Browse the repository at this point in the history
  • Loading branch information
zasweq committed Sep 14, 2021
1 parent 9f750d1 commit 9e32cee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 8 additions & 0 deletions xds/internal/httpfilter/httpfilter.go
Expand Up @@ -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
Expand Down Expand Up @@ -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]
}
5 changes: 1 addition & 4 deletions xds/internal/httpfilter/rbac/rbac.go
Expand Up @@ -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"
Expand All @@ -38,9 +37,7 @@ import (
)

func init() {
if env.RBACSupport {
httpfilter.Register(builder{})
}
httpfilter.Register(builder{})
}

type builder struct {
Expand Down

0 comments on commit 9e32cee

Please sign in to comment.