feat: 迁移 Admin Repository 到 MySQL 8 (#79)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"cmautobuy/admin/internal/testutil"
|
||||
"cmautobuy/admin/model"
|
||||
"cmautobuy/admin/repository"
|
||||
)
|
||||
@@ -53,16 +54,7 @@ func TestListClientPageForUser_分页统计不泄露其他采购员客户端(t *
|
||||
// 用真实的 migrations,这样表结构变了测试会跟着失败。
|
||||
func newTestDB(t *testing.T) *sql.DB {
|
||||
t.Helper()
|
||||
|
||||
db, err := repository.Open(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatalf("打开测试库失败: %v", err)
|
||||
}
|
||||
if err := repository.Migrate(db); err != nil {
|
||||
t.Fatalf("迁移失败: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { db.Close() })
|
||||
return db
|
||||
return testutil.OpenMySQL(t)
|
||||
}
|
||||
|
||||
// insertTask 插一条待领取的任务,供领取相关的测试使用。
|
||||
|
||||
Reference in New Issue
Block a user