test_message_fetch: Fix a flaky test due to random message populated.

The messages populated in the test database are random in nature,
so there is a possibility of more than one resolved topic
messages returned by 'self.get_and_check_messages()' query
in 'test_get_messages_for_resolved_topics'.

That would result in a flaky behavior. This commit fixes the
flaky behavior.
This commit is contained in:
Prakhar Pratyush 2024-05-09 22:14:19 +05:30 committed by Tim Abbott
parent c1a5b47f41
commit fd335c06eb
1 changed files with 1 additions and 1 deletions

View File

@ -3166,7 +3166,7 @@ class GetOldMessagesTest(ZulipTestCase):
narrow = [dict(operator="is", operand="resolved")]
result = self.get_and_check_messages(
dict(narrow=orjson.dumps(narrow).decode(), anchor=anchor, num_before=1, num_after=1)
dict(narrow=orjson.dumps(narrow).decode(), anchor=anchor, num_before=0, num_after=0)
)
self.assert_length(result["messages"], 1)
self.assertEqual(result["messages"][0]["id"], anchor)