From 2c893d8c05e99b6c58c78d05f23ac22144795107 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Wed, 6 Sep 2023 07:07:58 +0200 Subject: [PATCH] [MM-43252] Fix flaky TestPreparePostListForClient (#24407) * Fix flaky TestPreparePostListForClient * Ignore order of returned elements * Revert timeout increase --- server/channels/app/post_metadata_test.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/channels/app/post_metadata_test.go b/server/channels/app/post_metadata_test.go index 7eacc4796d..b6e39ea4c4 100644 --- a/server/channels/app/post_metadata_test.go +++ b/server/channels/app/post_metadata_test.go @@ -66,7 +66,6 @@ func TestPreparePostListForClient(t *testing.T) { } func TestPreparePostForClient(t *testing.T) { - t.Skip("MM-43252") var serverURL string server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { @@ -169,14 +168,13 @@ func TestPreparePostForClient(t *testing.T) { reaction1 := th.AddReactionToPost(post, th.BasicUser, "smile") reaction2 := th.AddReactionToPost(post, th.BasicUser2, "smile") reaction3 := th.AddReactionToPost(post, th.BasicUser2, "ice_cream") + reactions := []*model.Reaction{reaction1, reaction2, reaction3} post.HasReactions = true clientPost := th.App.PreparePostForClient(th.Context, post, false, false, false) assert.Len(t, clientPost.Metadata.Reactions, 3, "should've populated Reactions") - assert.Equal(t, reaction1, clientPost.Metadata.Reactions[0], "first reaction is incorrect") - assert.Equal(t, reaction2, clientPost.Metadata.Reactions[1], "second reaction is incorrect") - assert.Equal(t, reaction3, clientPost.Metadata.Reactions[2], "third reaction is incorrect") + assert.ElementsMatch(t, reactions, clientPost.Metadata.Reactions) }) t.Run("files", func(t *testing.T) { @@ -185,6 +183,7 @@ func TestPreparePostForClient(t *testing.T) { fileInfo, err := th.App.DoUploadFile(th.Context, time.Now(), th.BasicTeam.Id, th.BasicChannel.Id, th.BasicUser.Id, "test.txt", []byte("test")) fileInfo.Content = "test" + fileInfo.ChannelId = th.BasicChannel.Id require.Nil(t, err) post, err := th.App.CreatePost(th.Context, &model.Post{