@@ -27,7 +27,7 @@ import (
27
27
"testing"
28
28
29
29
"github.com/stretchr/testify/assert"
30
- "k8s.io/utils/exec/testing"
30
+ testingexec "k8s.io/utils/exec/testing"
31
31
)
32
32
33
33
func makeLink (link , target string ) error {
@@ -193,7 +193,26 @@ func TestIsLikelyNotMountPoint(t *testing.T) {
193
193
}
194
194
return removeLink (targeLinkPath )
195
195
},
196
- true ,
196
+ false ,
197
+ false ,
198
+ },
199
+ {
200
+ "junction" ,
201
+ "targetDir" ,
202
+ func (base , fileName , targetLinkName string ) error {
203
+ target := filepath .Join (base , targetLinkName )
204
+ if err := os .Mkdir (target , 0o750 ); err != nil {
205
+ return err
206
+ }
207
+
208
+ // create a Junction file type on Windows
209
+ junction := filepath .Join (base , fileName )
210
+ if output , err := exec .Command ("cmd" , "/c" , "mklink" , "/J" , junction , target ).CombinedOutput (); err != nil {
211
+ return fmt .Errorf ("mklink failed: %v, link(%q) target(%q) output: %q" , err , junction , target , string (output ))
212
+ }
213
+ return nil
214
+ },
215
+ false ,
197
216
false ,
198
217
},
199
218
}
@@ -207,7 +226,7 @@ func TestIsLikelyNotMountPoint(t *testing.T) {
207
226
208
227
filePath := filepath .Join (base , test .fileName )
209
228
result , err := mounter .IsLikelyNotMountPoint (filePath )
210
- assert .Equal (t , result , test .expectedResult , "Expect result not equal with IsLikelyNotMountPoint(%s) return: %q, expected: %q" ,
229
+ assert .Equal (t , test .expectedResult , result , "Expect result not equal with IsLikelyNotMountPoint(%s) return: %q, expected: %q" ,
211
230
filePath , result , test .expectedResult )
212
231
213
232
if test .expectError {
0 commit comments