@@ -304,6 +304,8 @@ var _ = Describe("NodeServer", func() {
304304
305305 fluidPath := filepath .Join (tempDir , "runtime" , testName )
306306 targetPath := filepath .Join (tempDir , "target" )
307+ fakeMountPath := filepath .Join (tempDir , "mount" )
308+ originalPath := os .Getenv ("PATH" )
307309
308310 isMountedPatch := gomonkey .ApplyFunc (utils .IsMounted , func (absPath string ) (bool , error ) {
309311 return false , os .ErrNotExist
@@ -315,10 +317,11 @@ var _ = Describe("NodeServer", func() {
315317 })
316318 defer mountReadyPatch .Reset ()
317319
318- commandPatch := gomonkey .ApplyFunc (cmdguard .Command , func (name string , arg ... string ) (* exec.Cmd , error ) {
319- return exec .Command ("sh" , "-c" , "exit 0" ), nil
320+ Expect (os .WriteFile (fakeMountPath , []byte ("#!/bin/sh\n exit 0\n " ), 0755 )).To (Succeed ())
321+ Expect (os .Setenv ("PATH" , tempDir + string (os .PathListSeparator )+ originalPath )).To (Succeed ())
322+ DeferCleanup (func () {
323+ Expect (os .Setenv ("PATH" , originalPath )).To (Succeed ())
320324 })
321- defer commandPatch .Reset ()
322325
323326 req := & csi.NodePublishVolumeRequest {
324327 VolumeId : testVolumeID ,
0 commit comments