Add unit tests for Elasticsearch profiling query DAOs#13820
Merged
Conversation
Member
|
Please resolve conficts. |
Member
|
Pure UT could be excluded from changes. |
Add test coverage for the isMergedTable guard condition and query construction in five ES profiling DAOs: AsyncProfilerTaskQueryEsDAO, AsyncProfilerTaskLogQueryEsDAO, PprofTaskQueryEsDAO, PprofTaskLogQueryEsDAO, and JFRDataQueryEsDAO. Each test verifies that when logicSharding is disabled (all records merged to records-all), the RECORD_TABLE_NAME filter is correctly included in queries.
30450e3 to
c4ddd6c
Compare
wu-sheng
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add unit test coverage for the
isMergedTableguard condition and query construction in five Elasticsearch profiling query DAOs:AsyncProfilerTaskQueryEsDAO—getTaskList()with merged table filter andserviceIdfilter,getById()with merged table +TASK_IDfilterAsyncProfilerTaskLogQueryEsDAO—getTaskLogList()with merged table,TASK_IDfilter, and sort byOPERATION_TIMEPprofTaskQueryEsDAO—getTaskList()with merged table andserviceId,getById()with merged table +TASK_IDPprofTaskLogQueryEsDAO—getTaskLogList()with merged table,TASK_ID, and sortJFRDataQueryEsDAO—getByTaskIdAndInstancesAndEvent()with merged table,TASK_ID,EVENT_TYPE, and optionalINSTANCE_IDfilterWhy
When
logicSharding=false(default in single-node deployments), all Record-type tables are merged into a singlerecords-allphysical index. Each query must include aTABLE_COLUMN/RECORD_TABLE_NAMEfilter to scope results to the correct logical table. These tests verify that the guard condition (isMergedTable) and the filter are wired correctly.This follows the pattern established in
ProfileTaskQueryEsDAOTest(introduced alongside theProfileTaskQueryEsDAO.getById()fix).How the tests work
LOGIC_INDICES_CATALOGstatic map inIndexController.LogicIndicesRegisteris populated via reflection to simulatelogicSharding=falsefor each DAO's index.ElasticSearchClientis mocked;ArgumentCaptor<Search>captures the query sent to ES.Searchobject is serialized to JSON via Jackson and asserted to contain the expected field names.