From 932f2bb99855497696508eac73efd1705a1e0769 Mon Sep 17 00:00:00 2001 From: shum Date: Thu, 19 Feb 2026 07:29:36 +0000 Subject: [PATCH] core: fix flaky testGroupHistoryQuotes for non-deterministic connected item ordering --- tests/ChatTests/Groups.hs | 63 +++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/tests/ChatTests/Groups.hs b/tests/ChatTests/Groups.hs index 5ed66722d0..0ea220b573 100644 --- a/tests/ChatTests/Groups.hs +++ b/tests/ChatTests/Groups.hs @@ -5904,28 +5904,47 @@ testGroupHistoryQuotes = alice <# "#team bob> > bob BOB" alice <## " 4" - alice - #$> ( "/_get chat #1 count=6", - chat', - [ ((1, "ALICE"), Nothing), - ((0, "BOB"), Nothing), - ((1, "1"), Just (1, "ALICE")), - ((1, "2"), Just (0, "BOB")), - ((0, "3"), Just (1, "ALICE")), - ((0, "4"), Just (0, "BOB")) - ] - ) - bob - #$> ( "/_get chat #1 count=6", - chat', - [ ((0, "ALICE"), Nothing), - ((1, "BOB"), Nothing), - ((0, "1"), Just (0, "ALICE")), - ((0, "2"), Just (1, "BOB")), - ((1, "3"), Just (0, "ALICE")), - ((1, "4"), Just (1, "BOB")) - ] - ) + alice ##> "/_get chat #1 count=6" + rAlice <- chat' <$> getTermLine alice + -- "connected" item_ts may be after "ALICE" brokerTs, shifting the count=6 window + rAlice + `shouldSatisfy` ( `elem` + [ [ ((1, "ALICE"), Nothing), + ((0, "BOB"), Nothing), + ((1, "1"), Just (1, "ALICE")), + ((1, "2"), Just (0, "BOB")), + ((0, "3"), Just (1, "ALICE")), + ((0, "4"), Just (0, "BOB")) + ], + [ ((0, "connected"), Nothing), + ((0, "BOB"), Nothing), + ((1, "1"), Just (1, "ALICE")), + ((1, "2"), Just (0, "BOB")), + ((0, "3"), Just (1, "ALICE")), + ((0, "4"), Just (0, "BOB")) + ] + ] + ) + bob ##> "/_get chat #1 count=6" + rBob <- chat' <$> getTermLine bob + rBob + `shouldSatisfy` ( `elem` + [ [ ((0, "ALICE"), Nothing), + ((1, "BOB"), Nothing), + ((0, "1"), Just (0, "ALICE")), + ((0, "2"), Just (1, "BOB")), + ((1, "3"), Just (0, "ALICE")), + ((1, "4"), Just (1, "BOB")) + ], + [ ((0, "connected"), Nothing), + ((1, "BOB"), Nothing), + ((0, "1"), Just (0, "ALICE")), + ((0, "2"), Just (1, "BOB")), + ((1, "3"), Just (0, "ALICE")), + ((1, "4"), Just (1, "BOB")) + ] + ] + ) connectUsers alice cath addMember "team" alice cath GRAdmin