diff --git a/pkg/remote/codec/validate.go b/pkg/remote/codec/validate.go index 9b4de4de61..93748e7ecf 100644 --- a/pkg/remote/codec/validate.go +++ b/pkg/remote/codec/validate.go @@ -1,3 +1,19 @@ +/* + * Copyright 2024 CloudWeGo Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package codec import ( diff --git a/pkg/remote/codec/validate_test.go b/pkg/remote/codec/validate_test.go index 1fec69eb9e..6554d77bce 100644 --- a/pkg/remote/codec/validate_test.go +++ b/pkg/remote/codec/validate_test.go @@ -74,20 +74,16 @@ func TestPayloadChecksumGenerate(t *testing.T) { test.Assert(t, err == nil, err) test.Assert(t, len(strInfo) != 0) test.Assert(t, strInfo[getValidatorKey(ctx, pv)] != "") - message.Recycle() // failed, generate error message = initClientSendMsg(transport.TTHeader) - strInfo = message.TransInfo().TransStrInfo() ctx = context.WithValue(context.Background(), mockGenerateErrorKey, "true") err = payloadChecksumGenerate(ctx, pv, payload, message) test.Assert(t, err != nil, err) test.Assert(t, errors.Is(err, kerrors.ErrPayloadValidation)) - message.Recycle() // failed, exceed limit message = initClientSendMsg(transport.TTHeader) - strInfo = message.TransInfo().TransStrInfo() ctx = context.WithValue(context.Background(), mockExceedLimitKey, "true") err = payloadChecksumGenerate(ctx, pv, payload, message) test.Assert(t, err != nil, err) diff --git a/pkg/remote/trans/netpoll/bytebuf_test.go b/pkg/remote/trans/netpoll/bytebuf_test.go index e67d74699e..108b297f6e 100644 --- a/pkg/remote/trans/netpoll/bytebuf_test.go +++ b/pkg/remote/trans/netpoll/bytebuf_test.go @@ -223,19 +223,6 @@ func TestBytes(t *testing.T) { b1, err := netpollBuff.Bytes() test.Assert(t, err == nil) test.Assert(t, string(b1) == b) - - // GetBytesNoCopy - b2, n, err := netpollBuff.(remote.NocopyRead).GetBytesNoCopy() - test.Assert(t, n == len(b)) - test.Assert(t, err == nil) - actual := make([]byte, n) - off := 0 - for i := 0; i < len(b2); i++ { - off += copy(actual[off:], b2[i]) - } - for i := 0; i < n; i++ { - test.Assert(t, actual[i] == b[i]) - } } func TestRelease(t *testing.T) {