Skip to content

Commit

Permalink
Tests: Add unit tests and update travis with root
Browse files Browse the repository at this point in the history
The commit adds tests for nodeserver and
safe mounter

The commit also updates .tarvis.yaml
to run the tests with root permission.

This is necessary as some operations in
the unit tests require root priviledges
e.g. mounting.

Signed-off-by: Animesh Kumar <animuz111@gmail.com>
  • Loading branch information
animeshk08 committed May 24, 2020
1 parent 81e24a4 commit 6d4b41d
Show file tree
Hide file tree
Showing 5 changed files with 444 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ before_install:
- GO111MODULE=off go get github.com/mattn/goveralls

script:
- go test -covermode=count -coverprofile=profile.cov ./pkg/...
- sudo -E env "PATH=$PATH" go test -covermode=count -coverprofile=profile.cov ./pkg/...
- $GOPATH/bin/goveralls -coverprofile=profile.cov -service=travis-ci
Empty file modified Makefile
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions pkg/azurefile/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,13 @@ func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolu

klog.V(2).Infof("NodeUnstageVolume: CleanupMountPoint %s", stagingTargetPath)
if err := CleanupSMBMountPoint(d.mounter, stagingTargetPath, false); err != nil {
return nil, status.Errorf(codes.Internal, "failed to unmount staing target %q: %v", stagingTargetPath, err)
return nil, status.Errorf(codes.Internal, "failed to unmount staging target %q: %v", stagingTargetPath, err)
}

targetPath := filepath.Join(filepath.Dir(stagingTargetPath), proxyMount)
klog.V(2).Infof("NodeUnstageVolume: CleanupMountPoint %s", targetPath)
if err := CleanupMountPoint(d.mounter, targetPath, false); err != nil {
return nil, status.Errorf(codes.Internal, "failed to unmount staing target %q: %v", targetPath, err)
return nil, status.Errorf(codes.Internal, "failed to unmount staging target %q: %v", targetPath, err)
}
klog.V(2).Infof("NodeUnstageVolume: unmount %s successfully", stagingTargetPath)

Expand Down
Loading

0 comments on commit 6d4b41d

Please sign in to comment.