Skip to content

Add unit tests for JDBC query DAO SQL building#13800

Merged
wu-sheng merged 2 commits intoapache:masterfrom
currenjin:test/add-jdbc-query-dao-unit-tests
Apr 6, 2026
Merged

Add unit tests for JDBC query DAO SQL building#13800
wu-sheng merged 2 commits intoapache:masterfrom
currenjin:test/add-jdbc-query-dao-unit-tests

Conversation

@currenjin
Copy link
Copy Markdown
Contributor

Summary

Test plan

  • All new unit tests pass
  • Existing tests unaffected

Add unit tests for JDBCAlarmQueryDAO, JDBCLogQueryDAO,
JDBCTraceQueryDAO, and JDBCTopologyQueryDAO to verify
correct SQL query construction with various filter combinations.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit-test coverage for JDBC storage DAOs’ SQL construction to guard against regressions in generated query strings across multiple filter combinations.

Changes:

  • Add SQL-building unit tests for JDBCAlarmQueryDAO and JDBCLogQueryDAO via direct buildSQL(...) assertions.
  • Add SQL-capture tests for JDBCTraceQueryDAO query methods by intercepting jdbcClient.executeQuery(...).
  • Add SQL-capture tests for JDBCTopologyQueryDAO service/instance relation query variants to validate parentheses/OR chaining.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCTraceQueryDAOTest.java Verifies generated SQL for trace queries (traceId, segmentId IN, traceId+instanceId IN with correct conjunction/parentheses).
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCTopologyQueryDAOTest.java Verifies topology relation SQL filters and correct OR/parentheses structure for service/instance relations.
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCLogQueryDAOTest.java Verifies log query SQL under various filters, ordering, tag joins, and limit/offset behavior.
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCAlarmQueryDAOTest.java Verifies alarm query SQL under scope/keyword/duration/tag filters and limit/offset behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is great to see new UTs added to the coverage of more branches. Thanks!

@wu-sheng wu-sheng merged commit 8907f0c into apache:master Apr 6, 2026
418 of 420 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Test requirements about performance, feature or before release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants