forked from Shiloh/githaven
Fix setting.AppPath for integration tests (#1923)
Fix setting.AppPath for integration tests
This commit is contained in:
commit
889409ba31
@ -14,6 +14,7 @@ import (
|
|||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -59,14 +60,22 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initIntegrationTest() {
|
func initIntegrationTest() {
|
||||||
if setting.CustomConf = os.Getenv("GITEA_CONF"); setting.CustomConf == "" {
|
giteaRoot := os.Getenv("GITEA_ROOT")
|
||||||
fmt.Println("Environment variable $GITEA_CONF not set")
|
if giteaRoot == "" {
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
if os.Getenv("GITEA_ROOT") == "" {
|
|
||||||
fmt.Println("Environment variable $GITEA_ROOT not set")
|
fmt.Println("Environment variable $GITEA_ROOT not set")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
setting.AppPath = path.Join(giteaRoot, "gitea")
|
||||||
|
|
||||||
|
giteaConf := os.Getenv("GITEA_CONF")
|
||||||
|
if giteaConf == "" {
|
||||||
|
fmt.Println("Environment variable $GITEA_CONF not set")
|
||||||
|
os.Exit(1)
|
||||||
|
} else if !path.IsAbs(giteaConf) {
|
||||||
|
setting.CustomConf = path.Join(giteaRoot, giteaConf)
|
||||||
|
} else {
|
||||||
|
setting.CustomConf = giteaConf
|
||||||
|
}
|
||||||
|
|
||||||
setting.NewContext()
|
setting.NewContext()
|
||||||
models.LoadConfigs()
|
models.LoadConfigs()
|
||||||
|
Loading…
Reference in New Issue
Block a user