forked from TrueCloudLab/restic
s3: Remove file after usage in test
This commit is contained in:
parent
26c16b9fd3
commit
3b44b87137
1 changed files with 9 additions and 4 deletions
|
@ -15,10 +15,6 @@ func writeFile(t testing.TB, data []byte, offset int64) *os.File {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = os.Remove(tempfile.Name()); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err = tempfile.Write(data); err != nil {
|
if _, err = tempfile.Write(data); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -41,6 +37,15 @@ func TestGetRemainingSize(t *testing.T) {
|
||||||
_, _ = io.ReadFull(partReader, buf)
|
_, _ = io.ReadFull(partReader, buf)
|
||||||
|
|
||||||
partFileReader := writeFile(t, data, int64(partialRead))
|
partFileReader := writeFile(t, data, int64(partialRead))
|
||||||
|
defer func() {
|
||||||
|
if err := partFileReader.Close(); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.Remove(partFileReader.Name()); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
io.Reader
|
io.Reader
|
||||||
|
|
Loading…
Reference in a new issue