Skip to content

Commit

Permalink
use uuid dir
Browse files Browse the repository at this point in the history
  • Loading branch information
winglq committed Dec 17, 2024
1 parent 305e063 commit 787c8c7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions fs/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/internal/testutil"
"github.com/hanwen/go-fuse/v2/posixtest"
Expand Down Expand Up @@ -76,6 +77,11 @@ func newTestCase(t *testing.T, opts *testOptions) *testCase {
dir: opts.testDir,
T: t,
}
uid, _ := uuid.NewUUID()
tc.dir = filepath.Join(tc.dir, uid.String())
if err := os.Mkdir(tc.dir, 0755); err != nil {
t.Fatal(err)
}
tc.origDir = tc.dir + "/orig"
tc.mntDir = tc.dir + "/mnt"
if err := os.Mkdir(tc.origDir, 0755); err != nil {
Expand Down
7 changes: 6 additions & 1 deletion fuse/test/loopback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/fuse/nodefs"
"github.com/hanwen/go-fuse/v2/fuse/pathfs"
Expand Down Expand Up @@ -75,9 +76,13 @@ func NewTestCase(t *testing.T) *testCase {

const name string = "hello.txt"
const subdir string = "subdir"
uid, _ := uuid.NewUUID()

var err error
tc.tmpDir = t.TempDir()
tc.tmpDir = filepath.Join(t.TempDir(), uid.String())
if err := os.Mkdir(tc.tmpDir, 0755); err != nil {
t.Fatal(err)
}
tc.orig = tc.tmpDir + "/orig"
tc.mnt = tc.tmpDir + "/mnt"

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/hanwen/go-fuse/v2

require (
github.com/google/uuid v1.6.0
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
github.com/moby/sys/mountinfo v0.6.2
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=
Expand Down

0 comments on commit 787c8c7

Please sign in to comment.