chore(e2e): clean up e2e tests

This commit is contained in:
hexxa 2021-09-30 16:42:18 +08:00 committed by Hexxa
parent 5605839411
commit 74aa28d874
5 changed files with 31 additions and 49 deletions

View file

@ -6,6 +6,7 @@ import (
"io/ioutil"
"math/rand"
"net/http"
"os"
"path"
"strings"
"testing"
@ -40,7 +41,17 @@ func startTestServer(config string) *Server {
return srv
}
func waitForReady(addr string) bool {
func setUpEnv(t *testing.T, rootPath string, adminName, adminPwd string) {
os.Setenv("DEFAULTADMIN", adminName)
os.Setenv("DEFAULTADMINPWD", adminPwd)
os.RemoveAll(rootPath)
err := os.MkdirAll(rootPath, 0700)
if err != nil {
t.Fatal(err)
}
}
func isServerReady(addr string) bool {
retry := 20
setCl := client.NewSettingsClient(addr)