Skip to content

Commit df43eb9

Browse files
committed
merge conflict
1 parent c7f6204 commit df43eb9

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

internal/xds/server/routing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func RouteAndProcess(ss grpc.ServerStream) (grpc.ServerStream, error) {
6767
// header is present.
6868
authority := md.Get(":authority")
6969
if len(authority) == 0 {
70-
return rc.statusErrWithNodeID(codes.Internal, "no :authority header present")
70+
return nil, rc.statusErrWithNodeID(codes.Internal, "no :authority header present")
7171
}
7272
vh := findBestMatchingVirtualHostServer(authority[0], rc.vhs)
7373
if vh == nil {

internal/xds/server/routing_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ func (s *testServerTransportStream) SetHeader(metadata.MD) error { return nil }
125125
func (s *testServerTransportStream) SendHeader(metadata.MD) error { return nil }
126126
func (s *testServerTransportStream) SetTrailer(metadata.MD) error { return nil }
127127

128+
type testServerStream struct {
129+
grpc.ServerStream
130+
ctx context.Context
131+
}
132+
133+
func (s *testServerStream) Context() context.Context {
134+
return s.ctx
135+
}
136+
128137
func (s) TestRouteAndProcess_MissingAuthority(t *testing.T) {
129138
var ptr atomic.Pointer[usableRouteConfiguration]
130139
ptr.Store(&usableRouteConfiguration{})
@@ -135,7 +144,8 @@ func (s) TestRouteAndProcess_MissingAuthority(t *testing.T) {
135144
ctx = grpc.NewContextWithServerTransportStream(ctx, &testServerTransportStream{method: "/test.Service/Method"})
136145
ctx = metadata.NewIncomingContext(ctx, metadata.MD{})
137146

138-
err := RouteAndProcess(ctx)
147+
ss := &testServerStream{ctx: ctx}
148+
_, err := RouteAndProcess(ss)
139149
if status.Code(err) != codes.Internal {
140150
t.Fatalf("RouteAndProcess() returned error code %v, want %v", status.Code(err), codes.Internal)
141151
}

0 commit comments

Comments
 (0)