test(e2e): test uploading randomly (#53)
This commit is contained in:
parent
36844eb2e0
commit
68548051d5
2 changed files with 85 additions and 1 deletions
|
@ -1,10 +1,13 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/ihexxa/gocfg"
|
||||
"github.com/ihexxa/quickshare/src/client"
|
||||
fspkg "github.com/ihexxa/quickshare/src/fs"
|
||||
)
|
||||
|
||||
func startTestServer(config string) *Server {
|
||||
|
@ -47,3 +50,17 @@ func waitForReady(addr string) bool {
|
|||
|
||||
return false
|
||||
}
|
||||
|
||||
func compareFileContent(fs fspkg.ISimpleFS, filePath string, expectedContent string) (bool, error) {
|
||||
reader, err := fs.GetFileReader(path.Join("files", filePath))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
gotContent, err := ioutil.ReadAll(reader)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return string(gotContent) == expectedContent, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue