fix kafka attachment message id binding
This commit is contained in:
@@ -93,6 +93,12 @@ func TestEnqueueKafkaAuditEventPublishesCrossSystemEvent(t *testing.T) {
|
||||
func TestEnqueueKafkaFileAttachmentsBindRunsSynchronously(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
var uidGenerator types.UidGenerator
|
||||
if err := uidGenerator.Init(1, []byte("0123456789abcdef")); err != nil {
|
||||
t.Fatalf("initialize UID generator: %v", err)
|
||||
}
|
||||
store.SetTestUidGenerator(uidGenerator)
|
||||
defer store.SetTestUidGenerator(types.UidGenerator{})
|
||||
|
||||
oldKafkaBus := kafkaBus
|
||||
oldFiles := store.Files
|
||||
@@ -104,7 +110,8 @@ func TestEnqueueKafkaFileAttachmentsBindRunsSynchronously(t *testing.T) {
|
||||
kafkaBus = &kafkaRuntime{}
|
||||
files := mock_store.NewMockFilePersistenceInterface(ctrl)
|
||||
store.Files = files
|
||||
msgID := types.Uid(101)
|
||||
databaseMsgID := types.Uid(101)
|
||||
msgID := store.EncodeUid(int64(databaseMsgID))
|
||||
msg := &types.Message{
|
||||
ObjHeader: types.ObjHeader{Id: msgID.String(), CreatedAt: time.Date(2026, 9, 1, 10, 0, 0, 0, time.UTC)},
|
||||
TenantID: 7,
|
||||
@@ -114,7 +121,7 @@ func TestEnqueueKafkaFileAttachmentsBindRunsSynchronously(t *testing.T) {
|
||||
Head: types.KVMap{"x-im-type": "image"},
|
||||
}
|
||||
attachments := []string{"https://api.118im.com/v1/im/files/file_001"}
|
||||
files.EXPECT().LinkAttachments(types.TenantID(7), "", msgID, attachments).Return(nil)
|
||||
files.EXPECT().LinkAttachments(types.TenantID(7), "", databaseMsgID, attachments).Return(nil)
|
||||
|
||||
if err := enqueueKafkaFileAttachmentsBind(context.Background(), 7, msg, attachments); err != nil {
|
||||
t.Fatalf("enqueueKafkaFileAttachmentsBind returned error: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user