ddl: add a guard UT to limit the DefMaxOfIndexLimit to 512 (#60050)

This commit is contained in:
CbcWestwolf
2025-03-13 16:17:29 +08:00
committed by GitHub
parent 9e44059b83
commit 9e61bd2ef5

View File

@ -19,6 +19,7 @@ import (
"testing"
"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/pkg/config"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/testkit"
"github.com/stretchr/testify/require"
@ -146,3 +147,9 @@ func TestCreateDatabaseError(t *testing.T) {
tk.MustExec("create database db1;")
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/mockModifyJobSchemaId"))
}
// This is a hard-coded test to make sure that the DefMaxOfIndexLimit is 512
// This limitation can not be loosened to a larger number until tidb can handle more indexes on one table.
func TestCreateIndexErrTooManyKeys(t *testing.T) {
require.Equal(t, 512, config.DefMaxOfIndexLimit)
}