diff options
author | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-06-13 04:20:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-13 04:20:32 +0200 |
commit | 889409ba311f04ac890423ec9c3d2618d7842167 (patch) | |
tree | 719dbf0ce21dca0a7237e3e627b672eb24eb1d2d /integrations/integration_test.go | |
parent | e8c63e21aff177f5e884c463c7d7f500dba98dd4 (diff) | |
parent | 23d0735f906498ca273b7cac399e9c8f0a0f08e8 (diff) | |
download | gitea-889409ba311f04ac890423ec9c3d2618d7842167.tar.gz gitea-889409ba311f04ac890423ec9c3d2618d7842167.zip |
Fix setting.AppPath for integration tests (#1923)
Fix setting.AppPath for integration tests
Diffstat (limited to 'integrations/integration_test.go')
-rw-r--r-- | integrations/integration_test.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go index 1cc1eb049f..5c0da501d5 100644 --- a/integrations/integration_test.go +++ b/integrations/integration_test.go @@ -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() |