Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Aug 27, 2024
1 parent dc1a75a commit 5e64f16
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions integration_tests/mongo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ func testTypes(ctx context.Context, db *mongo.Database, mongoCfg config.MongoDB)
return fmt.Errorf("failed to get event from bytes: %w", err)
}

pkMap, err := dbz.GetPrimaryKey(actualPkBytes, &kafkalib.TopicConfig{CDCKeyFormat: kafkalib.JSONKeyFmt})
pkMap, err := dbz.GetPrimaryKey(actualPkBytes, kafkalib.TopicConfig{CDCKeyFormat: kafkalib.JSONKeyFmt})
if err != nil {
return fmt.Errorf("failed to get primary key: %w", err)
}

data, err := evt.GetData(pkMap, &kafkalib.TopicConfig{})
data, err := evt.GetData(pkMap, kafkalib.TopicConfig{})
if err != nil {
return fmt.Errorf("failed to get data: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions lib/mongo/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestParseMessagePartitionKey(t *testing.T) {
assert.NoError(t, err)

var dbz transferMongo.Debezium
pkMap, err := dbz.GetPrimaryKey(rawMsgBytes, &kafkalib.TopicConfig{CDCKeyFormat: kafkalib.JSONKeyFmt})
pkMap, err := dbz.GetPrimaryKey(rawMsgBytes, kafkalib.TopicConfig{CDCKeyFormat: kafkalib.JSONKeyFmt})
assert.NoError(t, err)
assert.Equal(t, "507f1f77bcf86cd799439011", pkMap["_id"])
}
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestParseMessage(t *testing.T) {
assert.NoError(t, err)

var dbz transferMongo.Debezium
pkMap, err := dbz.GetPrimaryKey(rawPkBytes, &kafkalib.TopicConfig{CDCKeyFormat: kafkalib.JSONKeyFmt})
pkMap, err := dbz.GetPrimaryKey(rawPkBytes, kafkalib.TopicConfig{CDCKeyFormat: kafkalib.JSONKeyFmt})
assert.NoError(t, err)

rawMsgBytes, err := json.Marshal(rawMsg.Event())
Expand All @@ -111,7 +111,7 @@ func TestParseMessage(t *testing.T) {
"nullValue": nil,
}

actualKVMap, err := kvMap.GetData(pkMap, &kafkalib.TopicConfig{})
actualKVMap, err := kvMap.GetData(pkMap, kafkalib.TopicConfig{})
assert.NoError(t, err)
for expectedKey, expectedVal := range expectedMap {
actualVal, isOk := actualKVMap[expectedKey]
Expand Down
8 changes: 2 additions & 6 deletions writers/transfer/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ func TestWriter_MessageToEvent(t *testing.T) {
assert.NoError(t, err)

writer := Writer{
cfg: transferCfg.Config{
SharedTransferConfig: transferCfg.SharedTransferConfig{},
},
tc: &kafkalib.TopicConfig{
CDCKeyFormat: kafkalib.JSONKeyFmt,
},
cfg: transferCfg.Config{SharedTransferConfig: transferCfg.SharedTransferConfig{}},
tc: kafkalib.TopicConfig{CDCKeyFormat: kafkalib.JSONKeyFmt},
}

evtOut, err := writer.messageToEvent(message)
Expand Down

0 comments on commit 5e64f16

Please sign in to comment.