Skip to content

Commit cf01996

Browse files
committed
convert implicit BDP toggle to explicit
1 parent b319d96 commit cf01996

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

default_dial_option_server_option_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ func (s) TestJoinDialOption(t *testing.T) {
146146
if cc.dopts.copts.InitialWindowSize != initialWindowSize {
147147
t.Fatalf("Unexpected cc.dopts.copts.InitialWindowSize: %d != %d", cc.dopts.copts.InitialWindowSize, initialWindowSize)
148148
}
149+
// Make sure static window size is not enabled when using WithInitialWindowSize.
150+
if cc.dopts.copts.StaticWindowSize {
151+
t.Fatalf("Unexpected cc.dopts.copts.StaticWindowSize: %t", cc.dopts.copts.StaticWindowSize)
152+
}
149153
}
150154

151155
// TestJoinServerOption tests the join server option. It configures a joined
@@ -162,6 +166,10 @@ func (s) TestJoinServerOption(t *testing.T) {
162166
if s.opts.initialWindowSize != initialWindowSize {
163167
t.Fatalf("Unexpected s.opts.initialWindowSize: %d != %d", s.opts.initialWindowSize, initialWindowSize)
164168
}
169+
// Make sure static window size is not enabled when using InitialWindowSize.
170+
if s.opts.staticWindowSize {
171+
t.Fatalf("Unexpected s.opts.staticWindowSize: %t", s.opts.staticWindowSize)
172+
}
165173
}
166174

167175
// funcTestHeaderListSizeDialOptionServerOption tests

test/channelz_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,10 @@ func (s) TestCZClientSocketMetricsStreamsAndMessagesCount(t *testing.T) {
10611061
func (s) TestCZClientAndServerSocketMetricsStreamsCountFlowControlRSTStream(t *testing.T) {
10621062
e := tcpClearRREnv
10631063
te := newTest(t, e)
1064+
// Before behavior change in PR #8665, large window sizes set
1065+
// using InitialWindowSize disabled BDP by default. Post the
1066+
// behavior change, we have to explicitly disable BDP.
1067+
te.serverStaticWindowSize = true
10641068
te.serverInitialWindowSize = 65536
10651069
// Avoid overflowing connection level flow control window, which will lead to
10661070
// transport being closed.

test/end2end_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5385,14 +5385,21 @@ func (s) TestClientWriteFailsAfterServerClosesStream(t *testing.T) {
53855385
}
53865386

53875387
type windowSizeConfig struct {
5388+
serverStaticWindowSize bool
5389+
clientStaticWindowSize bool
53885390
serverStream int32
53895391
serverConn int32
53905392
clientStream int32
53915393
clientConn int32
53925394
}
53935395

53945396
func (s) TestConfigurableWindowSizeWithLargeWindow(t *testing.T) {
5397+
// Before behavior change in PR #8665, large window sizes set
5398+
// using WithInitialWindowSize disabled BDP by default. Post the
5399+
// behavior change, we have to explicitly disable BDP.
53955400
wc := windowSizeConfig{
5401+
serverStaticWindowSize: true,
5402+
clientStaticWindowSize: true,
53965403
serverStream: 8 * 1024 * 1024,
53975404
serverConn: 12 * 1024 * 1024,
53985405
clientStream: 6 * 1024 * 1024,
@@ -5417,6 +5424,8 @@ func (s) TestConfigurableWindowSizeWithSmallWindow(t *testing.T) {
54175424

54185425
func testConfigurableWindowSize(t *testing.T, e env, wc windowSizeConfig) {
54195426
te := newTest(t, e)
5427+
te.serverStaticWindowSize = wc.serverStaticWindowSize
5428+
te.clientStaticWindowSize = wc.clientStaticWindowSize
54205429
te.serverInitialWindowSize = wc.serverStream
54215430
te.serverInitialConnWindowSize = wc.serverConn
54225431
te.clientInitialWindowSize = wc.clientStream

test/stream_cleanup_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ func (s) TestStreamCleanup(t *testing.T) {
4848
return &testpb.Empty{}, nil
4949
},
5050
}
51-
if err := ss.Start(nil, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(callRecvMsgSize))), grpc.WithInitialWindowSize(int32(initialWindowSize))); err != nil {
51+
52+
// Use a static flow control window.
53+
if err := ss.Start(nil, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(callRecvMsgSize))), grpc.WithStaticStreamWindowSize(int32(initialWindowSize))); err != nil {
5254
t.Fatalf("Error starting endpoint server: %v", err)
5355
}
5456
defer ss.Stop()
@@ -81,7 +83,8 @@ func (s) TestStreamCleanupAfterSendStatus(t *testing.T) {
8183
})
8284
},
8385
}
84-
if err := ss.Start(nil, grpc.WithInitialWindowSize(int32(initialWindowSize))); err != nil {
86+
// Use a static flow control window.
87+
if err := ss.Start(nil, grpc.WithStaticStreamWindowSize(int32(initialWindowSize))); err != nil {
8588
t.Fatalf("Error starting endpoint server: %v", err)
8689
}
8790
defer ss.Stop()

0 commit comments

Comments
 (0)