@cryptotaxi247 / kubo / commits / 5ce2deb5f

Test Fix: Nil error handling

In TestExternalUnmount, the Mount function is called which returns an error which can be nil. The error type is then used in a comparison where Error() is called on it. If the error is nil, this results in a panic. Added a if err != nil {} guard to make sure that Error() is not called if the value is nil On branch go-test-fix Changes to be committed: modified: fuse/node/mount_test.go License: MIT Signed-off-by: Chris Buesser <christopher.buesser@gmail.com>

Christopher Buesser committed May 2, 2019 at 19:43 UTC 5ce2deb5fc418abdd42bec61b8619b733589450f
1 file changed +5 -2
fuse/node/mount_test.go
+5 -2
@@ -64,9 +64,12 @@ func TestExternalUnmount(t *testing.T) {
64 mkdir(t, ipnsDir)
65
66 err = Mount(node, ipfsDir, ipnsDir)
67 - if strings.Contains(err.Error(), "unable to check fuse version") || err == fuse.ErrOSXFUSENotFound {
68 - t.Skip(err)
67 + if err != nil {
68 + if strings.Contains(err.Error(), "unable to check fuse version") || err == fuse.ErrOSXFUSENotFound {
69 + t.Skip(err)
70 + }
71 }
72 +
73 if err != nil {
74 t.Fatalf("error mounting: %v", err)
75 }