test(contrib/drivers/mysql): enhance complex query tests#4707
Merged
Conversation
da9e4c9 to
6096cf5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the MySQL driver's test coverage by adding comprehensive tests for complex query scenarios including JOINs, subqueries, and advanced WHERE conditions. The work aligns with issue #4689's goal to strengthen MySQL test coverage before porting tests to other database drivers.
Changes:
- Added 15 new test functions for WherePrefix* methods with various operators (IN, BETWEEN, comparison operators, LIKE, NULL checks)
- Added 6 new subquery test functions covering correlated queries, FROM/SELECT clause subqueries, nested queries, and complex combinations
- Added 6 new JOIN test functions for multi-table joins (5+ tables), self-joins, NULL handling in LEFT/RIGHT joins, ON vs WHERE semantics, and complex join conditions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| mysql_z_unit_model_where_test.go | Adds 15 test functions for WherePrefix*/WhereOrPrefix* methods and HAVING clause with aggregate functions |
| mysql_z_unit_feature_model_subquery_test.go | Adds fmt import and 6 test functions for subquery scenarios (correlated, FROM/SELECT clause, nested, complex) |
| mysql_z_unit_feature_model_join_test.go | Adds 6 test functions for advanced JOIN scenarios (5+ tables, self-join, NULL handling, ON vs WHERE) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add comprehensive tests for JOIN, SubQuery, and complex WHERE conditions. ## New Test Coverage ### Join Tests (mysql_z_unit_feature_model_join_test.go) - Inner/Left/Right Join operations - Multiple table joins with complex conditions - Join with aggregate functions and grouping ### SubQuery Tests (mysql_z_unit_feature_model_subquery_test.go) - Subquery in WHERE clause (IN, NOT IN, ANY, ALL) - Subquery in FROM clause - Subquery in SELECT clause - Correlated subqueries - Nested subqueries (3+ levels) ### Complex WHERE Tests (mysql_z_unit_model_where_test.go) - WherePrefix with various operators (LT, LTE, GT, GTE, Between, NotBetween) - WhereOr/WhereAnd combinations - Complex nested condition groups ## Total Added ~26 test functions across 3 files, 1040+ lines Ref gogf#4689
6096cf5 to
af13080
Compare
gqcn
approved these changes
Feb 27, 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.
Summary
Test coverage added: ~26 test functions across 3 files
Ref #4689
Test plan