1
1
mirror of https://github.com/go-gitea/gitea synced 2025-11-08 23:38:13 +00:00

Add test for ExtendCommentTreePathLength migration and fix bugs (#35791)

Co-authored-by: Mithilesh Gupta <guptamithilesh@protonmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Mithilesh Gupta
2025-10-31 06:19:26 +05:30
committed by GitHub
parent c3472dd395
commit ef90befef1
6 changed files with 82 additions and 26 deletions

View File

@@ -19,6 +19,7 @@ import (
"github.com/stretchr/testify/require"
"xorm.io/xorm"
"xorm.io/xorm/schemas"
)
// FIXME: this file shouldn't be in a normal package, it should only be compiled for tests
@@ -88,6 +89,16 @@ func PrepareTestEnv(t *testing.T, skip int, syncModels ...any) (*xorm.Engine, fu
return x, deferFn
}
func LoadTableSchemasMap(t *testing.T, x *xorm.Engine) map[string]*schemas.Table {
tables, err := x.DBMetas()
require.NoError(t, err)
tableMap := make(map[string]*schemas.Table)
for _, table := range tables {
tableMap[table.Name] = table
}
return tableMap
}
func MainTest(m *testing.M) {
testlogger.Init()