-
Notifications
You must be signed in to change notification settings - Fork 715
test: add pytest cases for dashboard functionality #8885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Failed to generate code suggestions for PR |
5751323 to
704e95b
Compare
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR significantly expands the dashboard test suite by adding 9 new comprehensive pytest test cases. The changes enhance test coverage for dashboard functionality including export/import, batch operations, variables, multi-tab dashboards, filtering, timed annotations, and hash-based conflict detection.
Key additions:
test_export_dashboard- validates dashboard export in portable formattest_move_multiple_dashboards_batch- tests batch moving dashboards between folderstest_dashboard_with_variables- verifies dashboard variable configuration (custom type, multi-select)test_dashboard_with_multiple_tabs- tests multi-tab dashboard creation and retrievaltest_list_dashboards_by_title_pattern- validates title-based filteringtest_list_dashboards_by_folder- tests folder-based filteringtest_create_timed_annotationandtest_get_timed_annotations- validates annotation lifecycletest_dashboard_hash_conflict_detection- verifies hash field tracking for conflict detectiontest_dashboard_with_panel_filters- tests complex panel-level filter configurations
The PR also includes minor improvements to existing tests:
- Added
USER_EMAILconstant extracted from environment variables - Improved
test_dashboard_search_stream_querywith better error handling and stream validation - Added skip logic when data streams are unavailable
Minor issues found:
- Uses
print()statements instead of logging framework (4 instances in lines 130-146) - Redundant
import pyteststatement inside a function (line 97)
Confidence Score: 4/5
- This PR is safe to merge with minimal risk - it only adds test cases without modifying production code
- The changes are low-risk as they only add new test cases to improve coverage of dashboard functionality. All new tests follow existing patterns, properly clean up resources, and handle edge cases. The only issues are minor style improvements (using logging instead of print statements) that don't affect functionality.
- No files require special attention - the style improvements for print statements are optional
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| tests/api-testing/tests/test_dashboards.py | 4/5 | Added 9 comprehensive pytest test cases for dashboard functionality including variables, tabs, annotations, export, and filtering - minor style improvements needed for print statements |
Sequence Diagram
sequenceDiagram
participant Test as Test Suite
participant API as Dashboard API
participant DB as Database
Note over Test,DB: Dashboard Export Test
Test->>API: POST /api/default/dashboards (create)
API->>DB: Store dashboard
DB-->>API: Dashboard created
API-->>Test: Return dashboard_id
Test->>API: GET /api/default/dashboards/{id}/export
API->>DB: Fetch dashboard
DB-->>API: Dashboard data
API-->>Test: Exported dashboard (v5 format)
Test->>API: DELETE /api/default/dashboards/{id}
API->>DB: Delete dashboard
DB-->>API: Deleted
API-->>Test: Success
Note over Test,DB: Dashboard with Variables Test
Test->>API: POST /api/default/dashboards (with variables)
API->>DB: Store dashboard + variables
DB-->>API: Dashboard created
API-->>Test: Return dashboard_id
Test->>API: GET /api/default/dashboards/{id}
API->>DB: Fetch dashboard
DB-->>API: Dashboard with variables
API-->>Test: Verify variables list
Test->>API: DELETE /api/default/dashboards/{id}
Note over Test,DB: Batch Move Dashboards Test
Test->>API: POST /api/v2/default/folders/dashboards
API->>DB: Create folder
DB-->>API: folder_id
API-->>Test: Return folder_id
loop Create 3 dashboards
Test->>API: POST /api/default/dashboards
API->>DB: Store dashboard
DB-->>API: dashboard_id
API-->>Test: Return dashboard_id
end
Test->>API: PATCH /api/default/dashboards/move (batch)
API->>DB: Update dashboard folders
DB-->>API: Updated
API-->>Test: Success
loop Cleanup
Test->>API: DELETE /api/default/dashboards/{id}
end
Note over Test,DB: Timed Annotations Test
Test->>API: POST /api/default/dashboards (with panels)
API->>DB: Store dashboard
DB-->>API: dashboard_id
API-->>Test: Return dashboard_id
Test->>API: POST /api/default/dashboards/{id}/annotations
API->>DB: Store annotations
DB-->>API: Success
API-->>Test: Annotations created
Test->>API: GET /api/default/dashboards/{id}/annotations
API->>DB: Fetch annotations
DB-->>API: Annotation data
API-->>Test: Return annotations
Test->>API: DELETE /api/default/dashboards/{id}
Additional Comments (1)
1 file reviewed, 2 comments
f8ca17d to
51674bf
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 271 | 254 | 0 | 16 | 1 | 94% | 3m 34s |
Testdino Test Results
|
Testdino Test Results
|
Testdino Test Results
|
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 343 | 0 | 19 | 3 | 94% | 4m 38s |
604d448 to
d65aa57
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 342 | 0 | 19 | 4 | 94% | 4m 38s |
d65aa57 to
fc7fb59
Compare
fc7fb59 to
3f7ff11
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 343 | 0 | 19 | 3 | 94% | 7m 6s |
No description provided.