From e2883bfe5f37b253cc98b44a1f13c5debc6b7693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Fri, 13 Mar 2020 12:36:57 +0100 Subject: [PATCH] Fixing flaky tests on save multiple posts (#14048) * Fixing flaky tests on save multiple posts * Addressing PR comments --- store/storetest/post_store.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/store/storetest/post_store.go b/store/storetest/post_store.go index 8d1f49be2b..24527c32ae 100644 --- a/store/storetest/post_store.go +++ b/store/storetest/post_store.go @@ -94,6 +94,8 @@ func testPostStoreSave(t *testing.T, ss store.Store) { replyPost.Message = "zz" + model.NewId() + "b" replyPost.RootId = rootPost.Id + // We need to sleep here to be sure the post is not created during the same millisecond + time.Sleep(time.Millisecond) _, err = ss.Post().Save(&replyPost) require.Nil(t, err) @@ -116,6 +118,8 @@ func testPostStoreSave(t *testing.T, ss store.Store) { post.UserId = model.NewId() post.Message = "zz" + model.NewId() + "b" + // We need to sleep here to be sure the post is not created during the same millisecond + time.Sleep(time.Millisecond) _, err = ss.Post().Save(&post) require.Nil(t, err) @@ -130,6 +134,8 @@ func testPostStoreSave(t *testing.T, ss store.Store) { post.Message = "zz" + model.NewId() + "b" post.CreateAt = 5 + // We need to sleep here to be sure the post is not created during the same millisecond + time.Sleep(time.Millisecond) _, err = ss.Post().Save(&post) require.Nil(t, err) @@ -143,6 +149,8 @@ func testPostStoreSave(t *testing.T, ss store.Store) { post.UserId = model.NewId() post.Message = "zz" + model.NewId() + "b" + // We need to sleep here to be sure the post is not created during the same millisecond + time.Sleep(time.Millisecond) _, err = ss.Post().Save(&post) require.Nil(t, err)