use temporary file instead of hardcoding /tmp/data for deal data

This commit is contained in:
vyzo 2020-06-25 15:27:11 +03:00
parent 889b440bb1
commit 0c00b8b2ab

View File

@ -138,12 +138,18 @@ func runBaselineClient(t *TestEnvironment) error {
data := make([]byte, 1600) data := make([]byte, 1600)
rand.New(rand.NewSource(time.Now().UnixNano())).Read(data) rand.New(rand.NewSource(time.Now().UnixNano())).Read(data)
err = ioutil.WriteFile("/tmp/data", data, 0755) file, err := ioutil.TempFile("/tmp", "data")
if err != nil {
return err
}
defer os.Remove(file.Name())
_, err = file.Write(data)
if err != nil { if err != nil {
return err return err
} }
fcid, err := client.ClientImport(ctx, api.FileRef{Path: "/tmp/data", IsCAR: false}) fcid, err := client.ClientImport(ctx, api.FileRef{Path: file.Name(), IsCAR: false})
if err != nil { if err != nil {
return err return err
} }