use temporary file instead of hardcoding /tmp/data for deal data
This commit is contained in:
parent
889b440bb1
commit
0c00b8b2ab
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user