From 8ba6c7f68ae8a167b0b02965ae61dbb49ae79d19 Mon Sep 17 00:00:00 2001 From: Ali Farooq <25732808+ali-farooq0@users.noreply.github.com> Date: Mon, 29 Jul 2019 13:48:28 -0400 Subject: [PATCH] MM-17311 - Flaky TestGroupStore/UpsertMember (#11717) * MM-17311 - Flaky TestGroupStore/UpsertMember * PR Feedback --- store/storetest/group_store.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/store/storetest/group_store.go b/store/storetest/group_store.go index 25ee660f74..3fc631361c 100644 --- a/store/storetest/group_store.go +++ b/store/storetest/group_store.go @@ -9,6 +9,7 @@ import ( "sort" "strings" "testing" + "time" "github.com/stretchr/testify/require" @@ -581,6 +582,8 @@ func testUpsertMember(t *testing.T, ss store.Store) { require.Zero(t, d2.DeleteAt) // Duplicate composite key (GroupId, UserId) + // Ensure new CreateAt > previous CreateAt for the same (groupId, userId) + time.Sleep(1 * time.Millisecond) _, err = ss.Group().UpsertMember(group.Id, user.Id) require.Nil(t, err) @@ -589,6 +592,8 @@ func testUpsertMember(t *testing.T, ss store.Store) { require.Equal(t, err.Id, "store.insert_error") // Restores a deleted member + // Ensure new CreateAt > previous CreateAt for the same (groupId, userId) + time.Sleep(1 * time.Millisecond) _, err = ss.Group().UpsertMember(group.Id, user.Id) require.Nil(t, err)