From 14054a532d090632f7505ebf38a24f24645a8656 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Wed, 21 Jun 2017 05:05:13 +0800 Subject: fix intermittent failure of TestGetPostsForChannel on CI server (#6702) --- api4/post_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'api4/post_test.go') diff --git a/api4/post_test.go b/api4/post_test.go index f2f18fbe8..bfc0c286a 100644 --- a/api4/post_test.go +++ b/api4/post_test.go @@ -363,7 +363,9 @@ func TestGetPostsForChannel(t *testing.T) { post3 := &model.Post{ChannelId: th.BasicChannel.Id, Message: "zz" + model.NewId() + "a", RootId: post1.Id} post3, _ = Client.CreatePost(post3) - time := model.GetMillis() + time.Sleep(300 * time.Millisecond) + since := model.GetMillis() + time.Sleep(300 * time.Millisecond) post4 := th.CreatePost() @@ -420,7 +422,7 @@ func TestGetPostsForChannel(t *testing.T) { post5 := th.CreatePost() - posts, resp = Client.GetPostsSince(th.BasicChannel.Id, time) + posts, resp = Client.GetPostsSince(th.BasicChannel.Id, since) CheckNoError(t, resp) if len(posts.Posts) != 2 { @@ -430,7 +432,7 @@ func TestGetPostsForChannel(t *testing.T) { found := make([]bool, 2) for _, p := range posts.Posts { - if p.CreateAt < time { + if p.CreateAt < since { t.Fatal("bad create at for post returned") } if p.Id == post4.Id { -- cgit v1.2.3-1-g7c22