test(files, users): add e2e test and fix issues

This commit is contained in:
hexxa 2020-12-10 22:22:38 +08:00
parent b065684a47
commit 0265baf1b1
15 changed files with 5015 additions and 5327 deletions

View file

@ -1,6 +1,11 @@
package server
import "github.com/ihexxa/gocfg"
import (
"time"
"github.com/ihexxa/gocfg"
"github.com/ihexxa/quickshare/src/client"
)
func startTestServer(config string) *Server {
defaultCfg, err := DefaultConfig()
@ -25,3 +30,20 @@ func startTestServer(config string) *Server {
go srv.Start()
return srv
}
func waitForReady(addr string) bool {
retry := 10
setCl := client.NewSettingsClient(addr)
for retry > 0 {
_, _, errs := setCl.Health()
if len(errs) > 0 {
time.Sleep(100)
} else {
return true
}
retry--
}
return false
}