Fix Groups messages export sanity test (#4775)

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2023-12-09 00:46:48 +05:30 committed by GitHub
parent eb4f238502
commit a66b500d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,20 @@ func CheckGroupsExport(
envs)
}
func removeDeletedMessages(
ctx context.Context,
tree *common.Sanitree[models.Channelable, models.ChatMessageable],
) {
for _, child := range tree.Children {
for _, leaf := range child.Leaves {
if leaf.Self.GetDeletedDateTime() != nil {
delete(child.Leaves, leaf.ID)
child.CountLeaves--
}
}
}
}
func checkChannelMessagesExport(
ctx context.Context,
ac api.Client,
@ -82,6 +96,8 @@ func checkChannelMessagesExport(
common.CompareLeaves(ctx, expect.Leaves, updatedResultLeaves, nil)
}
removeDeletedMessages(ctx, sourceTree)
common.CompareDiffTrees(
ctx,
sourceTree,
@ -146,6 +162,7 @@ func populateMessagesSanitree(
}
for _, msg := range filteredMsgs {
child.CountLeaves++
child.Leaves[ptr.Val(msg.GetId())] = &common.Sanileaf[
models.Channelable,
models.ChatMessageable,