tests: add a few explicit file Close() in matrix_test
These can cause EBUSY errors when unmounting.
This commit is contained in:
parent
8fcd39a3b0
commit
6e637f38ff
|
@ -146,6 +146,7 @@ func TestTruncate(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
defer file.Close()
|
||||||
// Grow to two blocks
|
// Grow to two blocks
|
||||||
file.Truncate(7000)
|
file.Truncate(7000)
|
||||||
test_helpers.VerifySize(t, fn, 7000)
|
test_helpers.VerifySize(t, fn, 7000)
|
||||||
|
@ -230,6 +231,7 @@ func TestFallocate(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
defer file.Close()
|
||||||
wellKnown := isWellKnownFS(test_helpers.DefaultCipherDir)
|
wellKnown := isWellKnownFS(test_helpers.DefaultCipherDir)
|
||||||
fd := int(file.Fd())
|
fd := int(file.Fd())
|
||||||
nBytes := test_helpers.Du(t, fd)
|
nBytes := test_helpers.Du(t, fd)
|
||||||
|
@ -333,7 +335,6 @@ func TestFallocate(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cleanup
|
// Cleanup
|
||||||
file.Close()
|
|
||||||
syscall.Unlink(fn)
|
syscall.Unlink(fn)
|
||||||
if !wellKnown {
|
if !wellKnown {
|
||||||
// Even though most tests have been executed still, inform the user
|
// Even though most tests have been executed still, inform the user
|
||||||
|
@ -348,6 +349,7 @@ func TestAppend(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
defer file.Close()
|
||||||
data := []byte("testdata123456789") // length 17
|
data := []byte("testdata123456789") // length 17
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
var hashWant string
|
var hashWant string
|
||||||
|
@ -381,6 +383,7 @@ func TestFileHoles(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("file create failed")
|
t.Errorf("file create failed")
|
||||||
}
|
}
|
||||||
|
defer file.Close()
|
||||||
foo := []byte("foo")
|
foo := []byte("foo")
|
||||||
file.Write(foo)
|
file.Write(foo)
|
||||||
file.WriteAt(foo, 4096)
|
file.WriteAt(foo, 4096)
|
||||||
|
|
Loading…
Reference in New Issue