Skip to content

Commit

Permalink
Test Fix: Nil error handling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cbuesser committed May 2, 2019
1 parent 9380660 commit 5ce2deb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fuse/node/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ func TestExternalUnmount(t *testing.T) {
mkdir(t, ipnsDir)

err = Mount(node, ipfsDir, ipnsDir)
if strings.Contains(err.Error(), "unable to check fuse version") || err == fuse.ErrOSXFUSENotFound {
t.Skip(err)
if err != nil {
if strings.Contains(err.Error(), "unable to check fuse version") || err == fuse.ErrOSXFUSENotFound {
t.Skip(err)
}
}

if err != nil {
t.Fatalf("error mounting: %v", err)
}
Expand Down

0 comments on commit 5ce2deb

Please sign in to comment.