Skip to content

Commit

Permalink
refactor: opencdc test examples
Browse files Browse the repository at this point in the history
  • Loading branch information
raulb committed Feb 7, 2024
1 parent 33fd889 commit 41ddc2f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pkg/processor/procbuiltin/unwrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const DebeziumRecordPayload = `{
"schema": {}
}`

const OpenCDCRecordCreatePayload = `{
const OpenCDCRecordWithAfterPayload = `{
"position": "NzgyNjJmODUtODNmMS00ZGQwLWEyZDAtNTRmNjA1ZjkyYTg0",
"operation": "create",
"metadata": {
Expand All @@ -52,6 +52,7 @@ const OpenCDCRecordCreatePayload = `{
},
"key": "MTc3NzQ5NDEtNTdhMi00MmZhLWI0MzAtODkxMmE5NDI0YjNh",
"payload": {
"before": null,
"after": {
"event_id": 1747353650,
"msg": "string 0e8955b3-7fb5-4dda-8064-e10dc007f00d",
Expand All @@ -62,7 +63,7 @@ const OpenCDCRecordCreatePayload = `{
}
}`

const OpenCDCRecordDeletePayload = `{
const OpenCDCRecordWithoutPayload = `{
"position": "Qy9ENDAwMjNCMA==",
"operation": "delete",
"metadata": {
Expand All @@ -80,9 +81,9 @@ const OpenCDCRecordDeletePayload = `{
}
}`

const OpenCDCRecordUpdatePayload = `{
const OpenCDCRecordWithBeforePayload = `{
"position": "NzgyNjJmODUtODNmMS00ZGQwLWEyZDAtNTRmNjA1ZjkyYTg0",
"operation": "update",
"operation": "delete",
"metadata": {
"conduit.source.connector.id": "source-generator-78lpnchx7tzpyqz:source",
"opencdc.readAt": "1706028953595546000",
Expand Down Expand Up @@ -727,7 +728,7 @@ func TestUnwrap_Process(t *testing.T) {
Payload: record.Change{
Before: nil,
After: record.RawData{
Raw: []byte(OpenCDCRecordCreatePayload),
Raw: []byte(OpenCDCRecordWithAfterPayload),
},
},
Position: []byte("eyJHcm91cElEIjoiNGQ2ZTBhMjktNzAwZi00Yjk4LWEzY2MtZWUyNzZhZTc4MjVjIiwiVG9waWMiOiJzdHJlYW0tNzhscG5jaHg3dHpweXF6LWdlbmVyYXRvciIsIlBhcnRpdGlvbiI6MCwiT2Zmc2V0IjoyMjF9"),
Expand Down Expand Up @@ -772,7 +773,7 @@ func TestUnwrap_Process(t *testing.T) {
Payload: record.Change{
Before: nil,
After: record.RawData{
Raw: []byte(OpenCDCRecordDeletePayload),
Raw: []byte(OpenCDCRecordWithoutPayload),
},
},
Position: []byte("eyJHcm91cElEIjoiNGQ2ZTBhMjktNzAwZi00Yjk4LWEzY2MtZWUyNzZhZTc4MjVjIiwiVG9waWMiOiJzdHJlYW0tNzhscG5jaHg3dHpweXF6LWdlbmVyYXRvciIsIlBhcnRpdGlvbiI6MCwiT2Zmc2V0IjoyMjF9"),
Expand Down Expand Up @@ -812,13 +813,13 @@ func TestUnwrap_Process(t *testing.T) {
Payload: record.Change{
Before: nil,
After: record.RawData{
Raw: []byte(OpenCDCRecordUpdatePayload),
Raw: []byte(OpenCDCRecordWithBeforePayload),
},
},
Position: []byte("eyJHcm91cElEIjoiNGQ2ZTBhMjktNzAwZi00Yjk4LWEzY2MtZWUyNzZhZTc4MjVjIiwiVG9waWMiOiJzdHJlYW0tNzhscG5jaHg3dHpweXF6LWdlbmVyYXRvciIsIlBhcnRpdGlvbiI6MCwiT2Zmc2V0IjoyMjF9"),
},
want: record.Record{
Operation: record.OperationUpdate,
Operation: record.OperationDelete,
Metadata: record.Metadata{
"conduit.source.connector.id": "source-generator-78lpnchx7tzpyqz:source",
"opencdc.readAt": "1706028953595546000",
Expand Down

0 comments on commit 41ddc2f

Please sign in to comment.