-
Notifications
You must be signed in to change notification settings - Fork 715
fix: dashboard unit tests #8239
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
PR Reviewer Guide 🔍(Review updated until commit ec5b089)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to ec5b089
Previous suggestionsSuggestions up to commit d8f5f12
|
614ff0d to
e709fc5
Compare
8c854cd to
ec5b089
Compare
|
Persistent review updated to latest commit ec5b089 |
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 Summary
This PR adds comprehensive unit test coverage for 6 critical dashboard composables in the Vue.js frontend, adding approximately 2,700+ lines of test code. The tests cover:
- useAnnotations.spec.ts (310 lines): Tests the annotations fetching composable including parameter validation, error handling, API response processing, and edge cases with proper mocking of the annotation service
- useAnnotationsData.spec.ts (582 lines): Tests the annotations data management composable covering UI state toggles, dialog visibility, annotation creation/editing, panel fetching via
getDashboard, and time conversion logic including zero/negative value handling - useCancelQuery.spec.ts (542 lines): Tests the query cancellation workflows including trace ID management, concurrent operations, error scenarios, and integration with notification services and Vuex store
- usePanelCache.spec.ts (524 lines): Tests the IndexedDB-based panel caching system with sophisticated mocking, covering save/retrieve operations, error handling, data integrity, and global cache management functions
- useValuesWebSocket.spec.ts (719 lines): Tests the WebSocket/streaming/REST API communication for fetching field values, including response handling, filter merging, trace ID management, and fallback mechanisms
- usePanelDataLoader.spec.ts (2,666 lines): The largest test file covering the core data loading composable with extensive testing of WebSocket connections, caching, variable processing, error handling, and various panel configurations
These composables are fundamental to the dashboard functionality in OpenObserve, handling data fetching, caching, real-time communication, annotations, and query management. The tests follow proper testing patterns with comprehensive mocking, edge case coverage, and proper cleanup procedures. The test suite significantly improves code coverage for critical dashboard components that were previously untested.
Confidence score: 4/5
- This PR is generally safe to merge as it only adds test files without modifying production code
- Score reflects the comprehensive nature of the tests but acknowledges that test-only changes have minimal production risk
- Pay close attention to the useCancelQuery.spec.ts file for potential issues with undefined store state handling
6 files reviewed, 1 comment
| object: { | ||
| deep: { | ||
| value: "test", | ||
| array: [null, null, true, false], // undefined becomes null after JSON serialization |
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.
syntax: Comment about JSON serialization behavior is incorrect - undefined values are removed, not converted to null in JSON
| array: [null, null, true, false], // undefined becomes null after JSON serialization | |
| array: [null, null, true, false], // undefined values are omitted during JSON serialization |
92376f5 to
7959cd3
Compare
7959cd3 to
9f71e8a
Compare
PR Type
Tests, Enhancement
Description
Add comprehensive unit tests for data loaders
Add WebSocket/streaming values tests
Add annotations data workflow tests
Improve loader mocks and error handling
Diagram Walkthrough
File Walkthrough
usePanelDataLoader.spec.ts
Comprehensive tests for panel data loaderweb/src/composables/dashboard/usePanelDataLoader.spec.ts
useValuesWebSocket.spec.ts
Tests for values WebSocket and fetching pathsweb/src/composables/dashboard/useValuesWebSocket.spec.ts
useAnnotationsData.spec.ts
Unit tests for annotations data composableweb/src/composables/dashboard/useAnnotationsData.spec.ts
usePanelCache.spec.ts
Tests for panel cache behaviorweb/src/composables/dashboard/usePanelCache.spec.ts
useCancelQuery.spec.ts
Tests for cancel query composableweb/src/composables/dashboard/useCancelQuery.spec.ts
useAnnotations.spec.ts
Tests for annotations composableweb/src/composables/dashboard/useAnnotations.spec.ts