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

@ -17,7 +17,7 @@ import (
func TestFileHandlers(t *testing.T) {
addr := "http://127.0.0.1:8686"
root := "testData"
rootPath := "testData"
config := `{
"users": {
"enableAuth": true,
@ -41,21 +41,13 @@ func TestFileHandlers(t *testing.T) {
adminName := "qs"
adminPwd := "quicksh@re"
os.Setenv("DEFAULTADMIN", adminName)
os.Setenv("DEFAULTADMINPWD", adminPwd)
os.RemoveAll(root)
err := os.MkdirAll(root, 0700)
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(root)
setUpEnv(t, rootPath, adminName, adminPwd)
defer os.RemoveAll(rootPath)
srv := startTestServer(config)
defer srv.Shutdown()
fs := srv.depsFS()
if !waitForReady(addr) {
if !isServerReady(addr) {
t.Fatal("fail to start server")
}
@ -69,6 +61,7 @@ func TestFileHandlers(t *testing.T) {
token := client.GetCookie(resp.Cookies(), q.TokenCookie)
cl := client.NewFilesClient(addr, token)
var err error
// TODO: remove all files under home folder before testing
// or the count of files is incorrect
t.Run("ListHome", func(t *testing.T) {