fix(files): fix fd closing issue

This commit is contained in:
hexxa 2021-09-16 21:07:23 +08:00 committed by Hexxa
parent 5e8567d470
commit 1b0bf9c5fd
6 changed files with 72 additions and 18 deletions

View file

@ -83,20 +83,20 @@ func assertUploadOK(t *testing.T, filePath, content, addr string, token *http.Co
fileSize := int64(len([]byte(content)))
res, _, errs := cl.Create(filePath, fileSize)
if len(errs) > 0 {
t.Error(errs)
t.Fatal(errs)
return false
} else if res.StatusCode != 200 {
t.Error(res.StatusCode)
t.Fatal(res.StatusCode)
return false
}
base64Content := base64.StdEncoding.EncodeToString([]byte(content))
res, _, errs = cl.UploadChunk(filePath, base64Content, 0)
if len(errs) > 0 {
t.Error(errs)
t.Fatal(errs)
return false
} else if res.StatusCode != 200 {
t.Error(res.StatusCode)
t.Fatal(res.StatusCode)
return false
}