Skip to content

Commit d4494bd

Browse files
committed
test: update TestGreaterOrEqualVersion for the widened MariaDB guard
The previous test included two hypothetical "future MySQL 22.x" cases expecting `GreaterOrEqualVersion` to return true. With the guard widened from `major == 10` to `major >= 10` in the prior commit (to stop MariaDB 11.x being misclassified as "MySQL >= 8.0.23"), those cases now correctly return false — major >= 10 is treated as MariaDB territory. Also adds an explicit MariaDB 11.4.9 vs MySQL 8.0.23 case so the issue #82 regression is caught directly by a unit test, plus a doc comment on the test explaining the heuristic and pointing callers at `common.HasCapability` for flavor-aware checks.
1 parent 9e188c8 commit d4494bd

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

common/version_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,22 @@ func TestVersionToList(t *testing.T) {
139139

140140
func TestGreaterOrEqualVersion(t *testing.T) {
141141

142+
// `GreaterOrEqualVersion` is a flavor-blind heuristic. It deliberately
143+
// returns false for any version whose major >= 10 — that range is
144+
// reserved for MariaDB (10.x, 11.x, ...), which has diverged from the
145+
// MySQL version line that the *MinimumVersion* constants in globals/
146+
// were derived against. MySQL has not shipped a 10.x or 11.x major
147+
// line; if it ever does, callers should already have migrated to
148+
// `common.HasCapability(flavor, feature, version)`, which is the
149+
// flavor-aware replacement.
142150
var versions = []versionPair{
143151
{"5.0.0", []int{5, 6, 0}, false},
144152
{"8.0.0", []int{5, 6, 0}, true},
145153
{"ps5.7.5", []int{5, 7, 0}, true},
146154
{"10.0.1", []int{5, 6, 0}, false},
147-
{"22.0.0", []int{22, 0, 0}, true},
148-
{"22.10.2", []int{22, 10, 2}, true},
155+
{"11.4.9", []int{8, 0, 23}, false}, // MariaDB 11.x must not be treated as MySQL >= 8.0.23 (issue #82)
156+
{"22.0.0", []int{22, 0, 0}, false}, // major >= 10 is treated as MariaDB
157+
{"22.10.2", []int{22, 10, 2}, false},
149158
}
150159
for _, v := range versions {
151160
result, err := GreaterOrEqualVersion(v.version, v.versionList)

0 commit comments

Comments
 (0)