Skip to content

Commit 377b8eb

Browse files
committed
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 <oleksandr2088@icloud.com>
1 parent f9141af commit 377b8eb

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/actual_tests/talk_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ def test_conversation_create_delete(nc):
8585
def test_get_conversations_modified_since(nc):
8686
if nc.talk.available is False:
8787
pytest.skip("Nextcloud Talk is not installed")
88+
# Talk creates the "Note to self", sample and changelog conversations while serving a user's first
89+
# rooms request, after it has captured the timestamp it reports in `X-Nextcloud-Talk-Modified-Before`.
90+
# Those rooms are therefore newer than that timestamp; fetch once up front so that their creation
91+
# cannot land inside the window checked below.
92+
nc.talk.get_user_conversations()
8893
conversation = nc.talk.create_conversation(talk.ConversationType.GROUP, "admin")
8994
try:
9095
conversations = nc.talk.get_user_conversations()
@@ -102,6 +107,8 @@ def test_get_conversations_modified_since(nc):
102107
async def test_get_conversations_modified_since_async(anc):
103108
if await anc.talk.available is False:
104109
pytest.skip("Nextcloud Talk is not installed")
110+
# see the comment in the sync test above
111+
await anc.talk.get_user_conversations()
105112
conversation = await anc.talk.create_conversation(talk.ConversationType.GROUP, "admin")
106113
try:
107114
conversations = await anc.talk.get_user_conversations()

0 commit comments

Comments
 (0)