Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions common/persistence/serialization/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ func Decode(data *commonpb.DataBlob, result proto.Message) error {
if data == nil {
return NewDeserializationError(enumspb.ENCODING_TYPE_UNSPECIFIED, errors.New("cannot decode nil"))
}
if data.Data == nil {
return nil
}

switch data.EncodingType {
case enumspb.ENCODING_TYPE_JSON:
Expand Down
10 changes: 10 additions & 0 deletions common/persistence/serialization/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ func TestProtoDecode(t *testing.T) {
assert.Contains(t, err.Error(), "cannot decode nil")
})

t.Run("empty data blob", func(t *testing.T) {
blob := &commonpb.DataBlob{}

var result persistencespb.ShardInfo
err := Decode(blob, &result)
require.Error(t, err)
assert.IsType(t, &UnknownEncodingTypeError{}, err)
assert.Contains(t, err.Error(), "unknown or unsupported encoding type Unspecified")
})

t.Run("nil data field", func(t *testing.T) {
blob := &commonpb.DataBlob{
Data: nil,
Expand Down
Loading