do not run initDB within integration tests

This commit is contained in:
Earl Warren 2023-03-09 14:46:23 +01:00
parent 6621b04458
commit 5a0428ede3
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -9,7 +9,6 @@ import (
"log" "log"
actions_model "code.gitea.io/gitea/models/actions" actions_model "code.gitea.io/gitea/models/actions"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/util"
@ -30,18 +29,20 @@ var CmdActions = cli.Command{
}, },
} }
func runActions(ctx *cli.Context) error { func maybeInitDB(stdCtx context.Context) error {
setting.InitProviderFromExistingFile() if setting.Database.Type == "" {
setting.LoadCommonSettings() if err := initDB(stdCtx); err != nil {
setting.LoadDBSetting() return err
}
stdCtx, cancel := installSignals() }
defer cancel()
if err := db.InitEngine(stdCtx); err != nil {
fmt.Println(err)
fmt.Println("Check if you are using the right config file. You can use a --config directive to specify one.")
return nil return nil
}
func runActions(ctx *cli.Context) error {
stdCtx := context.Background()
if err := maybeInitDB(stdCtx); err != nil {
log.Fatalf("maybeInitDB %v", err)
} }
if ctx.Bool("registration-token-admin") { if ctx.Bool("registration-token-admin") {