From 0c00b8b2ab8b72c45dc58901a9b4f1b99dccd1e3 Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 25 Jun 2020 15:27:11 +0300 Subject: [PATCH] use temporary file instead of hardcoding /tmp/data for deal data --- lotus-soup/baseline.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lotus-soup/baseline.go b/lotus-soup/baseline.go index 0c019a4e4..6d037642a 100644 --- a/lotus-soup/baseline.go +++ b/lotus-soup/baseline.go @@ -138,12 +138,18 @@ func runBaselineClient(t *TestEnvironment) error { data := make([]byte, 1600) 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 { 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 { return err }