tests: make usagetests robust#9956
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe test files have been updated to replace manual retry attributes and explicit sleep calls with a unified Changes
Sequence Diagram(s)sequenceDiagram
participant TestMethod
participant assertEventually
participant API
TestMethod->>assertEventually: Provide closure with API call & assertions
loop Retry until success or timeout
assertEventually->>API: Make API request
API-->>assertEventually: Return response
assertEventually->>assertEventually: Run assertions
end
assertEventually-->>TestMethod: Return when assertions pass or timeout
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
✨ 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
|
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
tests/e2e/General/UsageTest.php (1)
1-1:⚠️ Potential issueFix PSR-12 style violations detected by pipeline.
The GitHub Actions linter has detected PSR-12 style violations including method argument spacing and array indentation issues. Please run the following command to automatically fix these formatting issues:
vendor/bin/pint🧰 Tools
🪛 GitHub Actions: Linter
[error] 1-1: PSR 12 style check failed: method_argument_space, array_indentation, and other style issues detected. Run 'vendor/bin/pint' to fix.
🧹 Nitpick comments (1)
tests/e2e/General/UsageTest.php (1)
587-587: Remove unnecessary empty line.This appears to be an extraneous empty line that should be removed for cleaner code formatting.
-
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/e2e/General/UsageTest.php(6 hunks)
🧰 Additional context used
🪛 GitHub Actions: Linter
tests/e2e/General/UsageTest.php
[error] 1-1: PSR 12 style check failed: method_argument_space, array_indentation, and other style issues detected. Run 'vendor/bin/pint' to fix.
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: scan
🔇 Additional comments (14)
tests/e2e/General/UsageTest.php (14)
189-208: LGTM! Clean refactoring to use assertEventually pattern.The refactoring correctly wraps the API call and assertions in the new retry mechanism, maintaining the same test logic while standardizing the retry approach.
210-221: Good refactoring of the second usage stats check.The migration to
assertEventuallyis properly implemented, preserving all original assertions and test logic.
372-389: Excellent variable scoping in closure.The refactoring correctly captures the required variables (
$requestsTotal,$storageTotal) in the closure using theuseclause, maintaining proper test logic.
391-404: Proper implementation of storage usage assertions.The refactoring maintains all storage-related assertions while correctly implementing the new retry pattern with proper variable scoping.
406-415: Clean bucket-specific usage validation.The refactoring properly handles bucket-specific usage checks with correct variable capture and assertion preservation.
597-616: Well-implemented database stats validation.The refactoring correctly wraps the project usage checks with proper variable capture and maintains all database-related assertions.
618-631: Comprehensive database usage assertions maintained.The migration to
assertEventuallyproperly handles all database usage metrics validation with correct variable scoping.
633-645: Database-specific usage validation correctly implemented.The refactoring maintains proper database-specific usage checks with correct variable capture and assertion logic.
647-656: Collection-specific usage validation properly refactored.The migration correctly handles collection-specific usage metrics with proper variable capture and maintains all document-related assertions.
821-846: Comprehensive function usage metrics validation.The refactoring correctly implements the new retry pattern for function-specific usage checks, maintaining all deployment, build, and execution assertions.
848-873: Global functions usage validation well-implemented.The migration maintains all global functions usage assertions while properly implementing the standardized retry mechanism.
953-985: Comprehensive site usage metrics validation.The refactoring correctly handles site-specific usage validation with proper variable capture for multiple metrics and maintains all deployment and execution assertions.
987-1017: Global sites usage validation properly migrated.The refactoring maintains all global sites usage assertions while correctly implementing the new retry pattern with proper variable scoping.
1054-1080: Proper handling of custom domains function stats with reference variables.The refactoring correctly implements the retry pattern for both function-specific and project usage calls. The use of reference variables (
&$response) properly captures responses for later comparison, maintaining the test's logic for validating metric changes.
7be7491 to
75f00a4
Compare
✨ Benchmark results
⚡ Benchmark Comparison
|
commit-id:336a4f07
commit-id:35fcc17d
75f00a4 to
c19d123
Compare
tests: fix flaky messaging test
Stack:
Summary by CodeRabbit