From 377b8eb3a3b069eaedddb92857d3963a062628ba Mon Sep 17 00:00:00 2001 From: Oleksandr Piskun Date: Tue, 11 Aug 2026 07:59:58 +0000 Subject: [PATCH] test(talk): fetch rooms once before checking modifiedSince Talk captures the timestamp it returns in X-Nextcloud-Talk-Modified-Before at the start of getRooms, and only then dispatches BeforeRoomsFetchEvent, whose listeners create the "Note to self", sample and changelog conversations for a user seeing Talk for the first time. Those rooms end up with a lastActivity newer than the timestamp already reported, so the test's window of "nothing was modified since T + 2 seconds" only held while that creation finished within two seconds. On a loaded CI runner it does not, and the returned sample rooms fail the assertion, which is what made the matrix jobs flaky. Fetch the rooms once before the timed sequence, so the lazy creation happens outside the window that is checked. Signed-off-by: Oleksandr Piskun --- tests/actual_tests/talk_test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/actual_tests/talk_test.py b/tests/actual_tests/talk_test.py index 61dc23aa..bfd9df1d 100644 --- a/tests/actual_tests/talk_test.py +++ b/tests/actual_tests/talk_test.py @@ -85,6 +85,11 @@ def test_conversation_create_delete(nc): def test_get_conversations_modified_since(nc): if nc.talk.available is False: pytest.skip("Nextcloud Talk is not installed") + # Talk creates the "Note to self", sample and changelog conversations while serving a user's first + # rooms request, after it has captured the timestamp it reports in `X-Nextcloud-Talk-Modified-Before`. + # Those rooms are therefore newer than that timestamp; fetch once up front so that their creation + # cannot land inside the window checked below. + nc.talk.get_user_conversations() conversation = nc.talk.create_conversation(talk.ConversationType.GROUP, "admin") try: conversations = nc.talk.get_user_conversations() @@ -102,6 +107,8 @@ def test_get_conversations_modified_since(nc): async def test_get_conversations_modified_since_async(anc): if await anc.talk.available is False: pytest.skip("Nextcloud Talk is not installed") + # see the comment in the sync test above + await anc.talk.get_user_conversations() conversation = await anc.talk.create_conversation(talk.ConversationType.GROUP, "admin") try: conversations = await anc.talk.get_user_conversations()