Skip to content

Commit 3b3045f

Browse files
committed
review comments #2
1 parent 3981553 commit 3b3045f

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

xds/internal/client/xds.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,11 @@ func processServerSideListener(lis *v3listenerpb.Listener) (*ListenerUpdate, err
269269
Port: strconv.Itoa(int(sockAddr.GetPortValue())),
270270
},
271271
}
272-
if err := validateNetworkFilterChains(append(lis.GetFilterChains(), lis.GetDefaultFilterChain())); err != nil {
272+
chains := lis.GetFilterChains()
273+
if def := lis.GetDefaultFilterChain(); def != nil {
274+
chains = append(chains, def)
275+
}
276+
if err := validateNetworkFilterChains(chains); err != nil {
273277
return nil, err
274278
}
275279

@@ -283,9 +287,6 @@ func processServerSideListener(lis *v3listenerpb.Listener) (*ListenerUpdate, err
283287

284288
func validateNetworkFilterChains(filterChains []*v3listenerpb.FilterChain) error {
285289
for _, filterChain := range filterChains {
286-
if filterChain == nil {
287-
continue
288-
}
289290
seenNames := make(map[string]bool, len(filterChain.GetFilters()))
290291
seenHCM := false
291292
for _, filter := range filterChain.GetFilters() {
@@ -315,11 +316,11 @@ func validateNetworkFilterChains(filterChains []*v3listenerpb.FilterChain) error
315316
// we have for HTTP filters), when we have to support network
316317
// filters other than HttpConnectionManager.
317318
if tc.GetTypeUrl() != version.V3HTTPConnManagerURL {
318-
return fmt.Errorf("filter chain {%+v} has unsupported network filter: %s", filterChain, tc.GetTypeUrl())
319+
return fmt.Errorf("filter chain {%+v} has unsupported network filter %q in filter {%+v}", filterChain, tc.GetTypeUrl(), filter)
319320
}
320321
hcm := &v3httppb.HttpConnectionManager{}
321322
if err := ptypes.UnmarshalAny(tc, hcm); err != nil {
322-
return fmt.Errorf("filter chain {%+v} failed unmarshaling of network filter: %v", filterChain, err)
323+
return fmt.Errorf("filter chain {%+v} failed unmarshaling of network filter {%+v}: %v", filterChain, filter, err)
323324
}
324325
// We currently don't support HTTP filters on the server-side.
325326
// We will be adding support for it in the future. So, we want

xds/internal/test/xds_server_integration_test.go

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,29 @@ import (
3333
"strconv"
3434
"testing"
3535

36-
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
37-
v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
38-
v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
39-
v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
40-
wrapperspb "github.com/golang/protobuf/ptypes/wrappers"
4136
"github.com/google/uuid"
42-
"google.golang.org/protobuf/proto"
43-
"google.golang.org/protobuf/types/known/anypb"
44-
45-
"google.golang.org/grpc/internal/testutils"
46-
xds2 "google.golang.org/grpc/internal/xds"
47-
4837
"google.golang.org/grpc"
4938
"google.golang.org/grpc/codes"
5039
"google.golang.org/grpc/credentials"
5140
"google.golang.org/grpc/credentials/insecure"
52-
xdscreds "google.golang.org/grpc/credentials/xds"
41+
"google.golang.org/grpc/internal/testutils"
5342
"google.golang.org/grpc/status"
54-
testpb "google.golang.org/grpc/test/grpc_testing"
5543
"google.golang.org/grpc/testdata"
5644
"google.golang.org/grpc/xds"
57-
xdstestutils "google.golang.org/grpc/xds/internal/testutils"
5845
"google.golang.org/grpc/xds/internal/testutils/e2e"
5946
"google.golang.org/grpc/xds/internal/version"
47+
"google.golang.org/protobuf/proto"
48+
"google.golang.org/protobuf/types/known/anypb"
49+
50+
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
51+
v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
52+
v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
53+
v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
54+
wrapperspb "github.com/golang/protobuf/ptypes/wrappers"
55+
xdscreds "google.golang.org/grpc/credentials/xds"
56+
xdsinternal "google.golang.org/grpc/internal/xds"
57+
testpb "google.golang.org/grpc/test/grpc_testing"
58+
xdstestutils "google.golang.org/grpc/xds/internal/testutils"
6059
)
6160

6261
const (
@@ -154,8 +153,8 @@ func commonSetup(t *testing.T) (*e2e.ManagementServer, string, net.Listener, fun
154153
cpc := e2e.DefaultFileWatcherConfig(path.Join(tmpdir, certFile), path.Join(tmpdir, keyFile), path.Join(tmpdir, rootFile))
155154

156155
// Create a bootstrap file in a temporary directory.
157-
bootstrapCleanup, err := xds2.SetupBootstrapFile(xds2.BootstrapOptions{
158-
Version: xds2.TransportV3,
156+
bootstrapCleanup, err := xdsinternal.SetupBootstrapFile(xdsinternal.BootstrapOptions{
157+
Version: xdsinternal.TransportV3,
159158
NodeID: nodeID,
160159
ServerURI: fs.Address,
161160
CertificateProviders: cpc,

0 commit comments

Comments
 (0)