mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 14:55:40 +03:00
do not run initDB within integration tests
This commit is contained in:
parent
6621b04458
commit
5a0428ede3
1 changed files with 12 additions and 11 deletions
|
@ -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 maybeInitDB(stdCtx context.Context) error {
|
||||||
|
if setting.Database.Type == "" {
|
||||||
|
if err := initDB(stdCtx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func runActions(ctx *cli.Context) error {
|
func runActions(ctx *cli.Context) error {
|
||||||
setting.InitProviderFromExistingFile()
|
stdCtx := context.Background()
|
||||||
setting.LoadCommonSettings()
|
|
||||||
setting.LoadDBSetting()
|
|
||||||
|
|
||||||
stdCtx, cancel := installSignals()
|
if err := maybeInitDB(stdCtx); err != nil {
|
||||||
defer cancel()
|
log.Fatalf("maybeInitDB %v", err)
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Bool("registration-token-admin") {
|
if ctx.Bool("registration-token-admin") {
|
||||||
|
|
Loading…
Reference in a new issue