From 6e637f38ffccd8be3d0e025aae53aeb382d99a08 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 1 Apr 2018 14:51:07 +0200 Subject: tests: add a few explicit file Close() in matrix_test These can cause EBUSY errors when unmounting. --- tests/matrix/matrix_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/matrix') diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go index 574f11f..37c7b20 100644 --- a/tests/matrix/matrix_test.go +++ b/tests/matrix/matrix_test.go @@ -146,6 +146,7 @@ func TestTruncate(t *testing.T) { if err != nil { t.FailNow() } + defer file.Close() // Grow to two blocks file.Truncate(7000) test_helpers.VerifySize(t, fn, 7000) @@ -230,6 +231,7 @@ func TestFallocate(t *testing.T) { if err != nil { t.FailNow() } + defer file.Close() wellKnown := isWellKnownFS(test_helpers.DefaultCipherDir) fd := int(file.Fd()) nBytes := test_helpers.Du(t, fd) @@ -333,7 +335,6 @@ func TestFallocate(t *testing.T) { } } // Cleanup - file.Close() syscall.Unlink(fn) if !wellKnown { // Even though most tests have been executed still, inform the user @@ -348,6 +349,7 @@ func TestAppend(t *testing.T) { if err != nil { t.FailNow() } + defer file.Close() data := []byte("testdata123456789") // length 17 var buf bytes.Buffer var hashWant string @@ -381,6 +383,7 @@ func TestFileHoles(t *testing.T) { if err != nil { t.Errorf("file create failed") } + defer file.Close() foo := []byte("foo") file.Write(foo) file.WriteAt(foo, 4096) -- cgit v1.2.3