aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/defaults/diriv_test.go2
-rw-r--r--tests/defaults/main_test.go2
-rw-r--r--tests/matrix/matrix_test.go2
3 files changed, 5 insertions, 1 deletions
diff --git a/tests/defaults/diriv_test.go b/tests/defaults/diriv_test.go
index 75f1511..9aba1f2 100644
--- a/tests/defaults/diriv_test.go
+++ b/tests/defaults/diriv_test.go
@@ -45,7 +45,7 @@ func TestDirIVRace(t *testing.T) {
for {
// Keep dir2 in the diriv cache
fd, err2 := os.Open(file2)
- if err2 != nil {
+ if err2 == nil {
fd.Close()
}
if stop {
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
index 5c6bb84..49c6dcf 100644
--- a/tests/defaults/main_test.go
+++ b/tests/defaults/main_test.go
@@ -51,6 +51,7 @@ func TestOpenTruncateRead(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ defer writeFd.Close()
abc := []byte("abc")
_, err = writeFd.WriteAt(abc, 0)
if err != nil {
@@ -61,6 +62,7 @@ func TestOpenTruncateRead(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ defer readFd.Close()
content := make([]byte, 3)
_, err = readFd.ReadAt(content, 0)
if err != nil {
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index d0ad0d5..d52c3f8 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -405,10 +405,12 @@ func TestRmwRace(t *testing.T) {
if err != nil {
t.Fatalf("file create failed")
}
+ defer f1.Close()
f2, err := os.Create(fn)
if err != nil {
t.Fatalf("file create failed")
}
+ defer f2.Close()
oldBlock := bytes.Repeat([]byte("o"), 4096)