Skip to content

Commit

Permalink
tiny fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand committed Nov 23, 2023
1 parent 1bee3f7 commit 8d43954
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cdc/sink/codec/canal/canal_json_encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,23 @@ func TestNewCanalJSONMessage4DML(t *testing.T) {

require.NotNil(t, withExtension.Extensions)
require.Equal(t, updateEvent.CommitTs, withExtension.Extensions.CommitTs)

codecConfig = common.NewConfig(config.ProtocolCanalJSON)
codecConfig.EnableTiDBExtension = true
codecConfig.ContentCompatible = true
encoder, ok = NewJSONBatchEncoderBuilder(codecConfig).Build().(*JSONBatchEncoder)
require.True(t, ok)

data, err = newJSONMessageForDML(updateEvent, encoder.config, encoder.builder, false)
require.NoError(t, err)

withExtension = &canalJSONMessageWithTiDBExtension{}
err = json.Unmarshal(data, withExtension)
require.Nil(t, err)
require.Equal(t, 0, len(withExtension.JSONMessage.Old[0]))

require.NotNil(t, withExtension.Extensions)
require.Equal(t, updateEvent.CommitTs, withExtension.Extensions.CommitTs)
}

func TestNewCanalJSONMessageHandleKeyOnly4LargeMessage(t *testing.T) {
Expand Down

0 comments on commit 8d43954

Please sign in to comment.