@@ -472,19 +472,20 @@ func TestOpenAlreadyLocked(t *testing.T) {
472
472
t .Run ("relative" , func (t * testing.T ) {
473
473
original , err := os .Getwd ()
474
474
require .NoError (t , err )
475
- defer func () { require .NoError (t , os .Chdir (original )) }()
476
475
477
476
for _ , tc := range testCases {
478
477
t .Run (tc .name , func (t * testing.T ) {
479
478
// Create a temporary directory structure for relative paths.
480
479
tempRoot := t .TempDir ()
481
- wd := filepath . Dir (tempRoot )
482
- require .NoError (t , os .Chdir (wd ) )
480
+ require . NoError ( t , os . Chdir (tempRoot ) )
481
+ defer func () { require .NoError (t , os .Chdir (original )) }( )
483
482
484
483
var tmpDirs [4 ]string
485
484
for i := range tmpDirs {
486
485
tmpDirs [i ] = filepath .Join (tempRoot , fmt .Sprintf ("dir%d" , i ))
487
- require .NoError (t , os .MkdirAll (tmpDirs [i ], 0755 ), "Failed to create temp dir %s" , tmpDirs [i ])
486
+ require .NoError (t , os .Mkdir (tmpDirs [i ], 0755 ), "Failed to create temp dir %s" , tmpDirs [i ])
487
+ tmpDirs [i ], err = filepath .Rel (tempRoot , tmpDirs [i ])
488
+ require .NoError (t , err )
488
489
}
489
490
490
491
runTest (t , tmpDirs , tc .setupLocks , vfs .Default )
0 commit comments