From bc42fb620a04ec1b6d2f8eff6eb49c7c93cf19cb Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Sat, 24 Dec 2022 02:32:29 +0000 Subject: [PATCH] test: fix ut on windows and darwin --- pkg/nfs/nfs.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/nfs/nfs.go b/pkg/nfs/nfs.go index 9ecd0e7e..039aea07 100644 --- a/pkg/nfs/nfs.go +++ b/pkg/nfs/nfs.go @@ -17,6 +17,7 @@ limitations under the License. package nfs import ( + "runtime" "strings" "github.com/container-storage-interface/spec/lib/go/csi" @@ -108,7 +109,12 @@ func (n *Driver) Run(testMode bool) { } klog.V(2).Infof("\nDRIVER INFORMATION:\n-------------------\n%s\n\nStreaming logs below:", versionMeta) - n.ns = NewNodeServer(n, mount.New("").(mount.MounterForceUnmounter)) + mounter := mount.New("") + if runtime.GOOS == "linux" { + // MounterForceUnmounter is only implemented on Linux now + mounter = mounter.(mount.MounterForceUnmounter) + } + n.ns = NewNodeServer(n, mounter) s := NewNonBlockingGRPCServer() s.Start(n.endpoint, NewDefaultIdentityServer(n),