222twotwotwo commented on code in PR #139:
URL: https://github.com/apache/dubbo-getty/pull/139#discussion_r3719922261


##########
session_test.go:
##########
@@ -32,6 +32,48 @@ func (errorReader) Read(Session, []byte) (any, int, error) {
        return nil, 0, errTestReadFailure
 }
 
+func TestUDPReadBufferLen(t *testing.T) {
+       tests := []struct {
+               name      string
+               maxMsgLen int32
+               want      int64
+       }{
+               {
+                       name:      "negative max message length uses default 
read buffer",
+                       maxMsgLen: -1,
+                       want:      int64(maxReadBufLen),
+               },
+               {
+                       name:      "zero max message length uses default read 
buffer",
+                       maxMsgLen: 0,
+                       want:      int64(maxReadBufLen),
+               },
+               {
+                       name:      "small max message length caps buffer at 
twice max message length",
+                       maxMsgLen: 1,
+                       want:      2,
+               },
+               {
+                       name:      "default max message length allows one extra 
read buffer",
+                       maxMsgLen: maxReadBufLen,
+                       want:      int64(maxReadBufLen * 2),
+               },
+               {
+                       name:      "larger max message length adds one read 
buffer",
+                       maxMsgLen: maxReadBufLen * 2,

Review Comment:
   收到,已覆盖



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to