Browse Source

Fix setting.AppPath for integration tests (#1923)

Fix setting.AppPath for integration tests
for-closed-social
Kim "BKC" Carlbäcker 7 years ago
committed by GitHub
parent
commit
889409ba31
1 changed files with 13 additions and 4 deletions
  1. +13
    -4
      integrations/integration_test.go

+ 13
- 4
integrations/integration_test.go View File

@ -14,6 +14,7 @@ import (
"net/http/cookiejar"
"net/url"
"os"
"path"
"strings"
"testing"
@ -59,13 +60,21 @@ func TestMain(m *testing.M) {
}
func initIntegrationTest() {
if setting.CustomConf = os.Getenv("GITEA_CONF"); setting.CustomConf == "" {
fmt.Println("Environment variable $GITEA_CONF not set")
giteaRoot := os.Getenv("GITEA_ROOT")
if giteaRoot == "" {
fmt.Println("Environment variable $GITEA_ROOT not set")
os.Exit(1)
}
if os.Getenv("GITEA_ROOT") == "" {
fmt.Println("Environment variable $GITEA_ROOT not set")
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()

Loading…
Cancel
Save