fix: test sometimes receives an error string containing unicode (#15791)

This commit is contained in:
Matt Kocubinski
2023-04-11 18:40:54 +00:00
committed by GitHub
parent d46328cb8d
commit e342a47254
+3 -5
View File
@@ -1,7 +1,7 @@
package decode_test
import (
"fmt"
"errors"
"testing"
"github.com/stretchr/testify/require"
@@ -456,7 +456,7 @@ func TestRejectUnknownFieldsNested(t *testing.T) {
recv: new(testpb.TestVersion1),
// behavior change from previous implementation: we allow mismatched wire -> proto types,
// but this will still error on ConsumeFieldValue
wantErr: fmt.Errorf(`could not consume field value for tagNum: 8, wireType: "unknown type: 7"; proto: cannot parse reserved wire type`),
wantErr: errors.New("cannot parse reserved wire type"),
},
{
name: "From nested proto message, message index 0",
@@ -501,7 +501,7 @@ func TestRejectUnknownFieldsNested(t *testing.T) {
desc := tt.recv.ProtoReflect().Descriptor()
gotErr := decode.RejectUnknownFieldsStrict(protoBlob, desc, ProtoResolver)
if tt.wantErr != nil {
require.EqualError(t, gotErr, tt.wantErr.Error())
require.ErrorContains(t, gotErr, tt.wantErr.Error())
} else {
require.NoError(t, gotErr)
}
@@ -636,8 +636,6 @@ func TestRejectUnknownFieldsFlat(t *testing.T) {
c1 := new(testpb.Customer1)
c1Desc := c1.ProtoReflect().Descriptor()
// err = proto.Unmarshal(blob, c1)
// require.NoError(t, err)
gotErr := decode.RejectUnknownFieldsStrict(blob, c1Desc, ProtoResolver)
if tt.wantErr != nil {
require.EqualError(t, gotErr, tt.wantErr.Error())