Fixing flaky tests on save multiple posts (#14048)
* Fixing flaky tests on save multiple posts * Addressing PR comments
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c8b60c2d75
Коммит
e2883bfe5f
@@ -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)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user