tests: fix flaky messaging test#9957
Conversation
|
Warning Rate limit exceeded@loks0n has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 45 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThe test for retrieving topic logs in the messaging console client has been updated to use an eventual assertion mechanism. This change allows the test to repeatedly attempt fetching and asserting the logs until the expected conditions are met or a timeout occurs, accommodating scenarios with eventual consistency. Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/e2e/Services/Messaging/MessagingConsoleClientTest.php (1)
362-370: Consider eventual consistency for message logs as well.The
testGetMessageLogsmethod has a similar pattern where it creates a message, updates it, and then immediately checks for 2 log entries. This might also benefit from eventual consistency handling to prevent potential flakiness.Consider wrapping this section in
assertEventually()as well:- $logs = $this->client->call(Client::METHOD_GET, '/messaging/messages/' . $email['body']['$id'] . '/logs', \array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals($logs['headers']['status-code'], 200); - $this->assertIsArray($logs['body']['logs']); - $this->assertIsNumeric($logs['body']['total']); - $this->assertCount(2, $logs['body']['logs']); + $this->assertEventually(function () use ($email) { + $logs = $this->client->call(Client::METHOD_GET, '/messaging/messages/' . $email['body']['$id'] . '/logs', \array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertIsArray($logs['body']['logs']); + $this->assertIsNumeric($logs['body']['total']); + $this->assertCount(2, $logs['body']['logs']); + });
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/e2e/Services/Messaging/MessagingConsoleClientTest.php(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/e2e/Services/Messaging/MessagingConsoleClientTest.php (1)
src/Executor/Executor.php (1)
call(302-428)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: scan
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build Appwrite Image
🔇 Additional comments (1)
tests/e2e/Services/Messaging/MessagingConsoleClientTest.php (1)
209-219: Good fix for handling eventual consistency!This change appropriately addresses the flaky test issue by wrapping the log retrieval and assertions in
assertEventually(). This allows the test to retry until the expected 2 log entries (create + update operations) are available, which is essential for handling eventual consistency in distributed systems.The implementation follows the same pattern used earlier in
testGetProviderLogs(lines 61-71) and maintains consistency with the existing codebase.
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
✨ Benchmark results
⚡ Benchmark Comparison
|
commit-id:336a4f07
ea8e769 to
b9579c8
Compare
75f00a4 to
c19d123
Compare
Stack: