Skip to content

Commit a62088e

Browse files
add mysql version validation
Signed-off-by: Harshit Gangal <[email protected]>
1 parent 2ed3ca0 commit a62088e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

go/test/endtoend/vtgate/foreignkey/fk_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,19 @@ func TestRestrictFkOnNonStandardKey(t *testing.T) {
15101510
mcmp, closer := start(t)
15111511
defer closer()
15121512

1513+
// First check MySQL version to ensure we're on 8.4+
1514+
versionResult := utils.Exec(t, mcmp.MySQLConn, `SELECT VERSION()`)
1515+
require.Equal(t, 1, len(versionResult.Rows), "Expected exactly one row for VERSION()")
1516+
version := versionResult.Rows[0][0].ToString()
1517+
t.Logf("MySQL version: %s", version)
1518+
1519+
// Check if we're on MySQL 8.4+
1520+
if !strings.HasPrefix(version, "8.4") && !strings.Contains(version, "8.4") {
1521+
t.Skipf("Skipping test - restrict_fk_on_non_standard_key is only available in MySQL 8.4+, current version: %s", version)
1522+
}
1523+
15131524
// Check the setting on the MySQL side - this verifies that our extra_my.cnf is being applied
15141525
result := utils.Exec(t, mcmp.MySQLConn, `SHOW VARIABLES LIKE 'restrict_fk_on_non_standard_key'`)
15151526
require.Equal(t, 1, len(result.Rows), "Expected exactly one row for restrict_fk_on_non_standard_key variable")
1516-
require.Equal(t, "OFF", result.Rows[0][1].ToString(), "Expected restrict_fk_on_non_standard_key to be OFF")
1527+
require.Equal(t, "ON", result.Rows[0][1].ToString(), "Expected restrict_fk_on_non_standard_key to be ON")
15171528
}

0 commit comments

Comments
 (0)