Skip to content

Commit

Permalink
Use inode.Rename in tests everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Jun 15, 2023
1 parent 1b63380 commit 8287e1b
Showing 1 changed file with 5 additions and 32 deletions.
37 changes: 5 additions & 32 deletions internal/goofys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,7 @@ func (s *GoofysTest) TestRenameToExisting(t *C) {
_, err = s.fs.LookupPath("file2")
t.Assert(err, IsNil)

err = s.fs.Rename(nil, &fuseops.RenameOp{
OldParent: root.Id,
NewParent: root.Id,
OldName: "file1",
NewName: "file2",
})
err = root.Rename("file1", root, "file2")
t.Assert(err, IsNil)

file1 := root.findChild("file1")
Expand Down Expand Up @@ -817,12 +812,7 @@ func (s *GoofysTest) TestRenameOpenedUnmodified(t *C) {
err = fh.inode.SyncFile()
t.Assert(err, IsNil)

err = s.fs.Rename(nil, &fuseops.RenameOp{
OldParent: root.Id,
NewParent: root.Id,
OldName: "file10",
NewName: "file20",
})
err = root.Rename("file10", root, "file20")
t.Assert(err, IsNil)

fh.Release()
Expand Down Expand Up @@ -1032,12 +1022,7 @@ func (s *GoofysTest) TestRenameDir(t *C) {
_, err = s.fs.LookupPath("new_dir2")
t.Assert(err, Equals, syscall.ENOENT)

err = s.fs.Rename(nil, &fuseops.RenameOp{
OldParent: root.Id,
NewParent: root.Id,
OldName: "dir2",
NewName: "new_dir2",
})
err = root.Rename("dir2", root, "new_dir2")
t.Assert(err, IsNil)

_, err = s.fs.LookupPath("dir2/dir3")
Expand All @@ -1061,12 +1046,7 @@ func (s *GoofysTest) TestRenameDir(t *C) {
_, err = s.fs.LookupPath("new_dir3")
t.Assert(err, Equals, syscall.ENOENT)

err = s.fs.Rename(nil, &fuseops.RenameOp{
OldParent: root.Id,
NewParent: root.Id,
OldName: "new_dir2",
NewName: "new_dir3",
})
err = root.Rename("new_dir2", root, "new_dir3")
t.Assert(err, IsNil)

new, err := s.fs.LookupPath("new_dir3/dir3/file4")
Expand Down Expand Up @@ -1361,14 +1341,7 @@ func (s *GoofysTest) TestRenameCache(t *C) {
err = s.fs.LookUpInode(nil, &lookupOp2)
t.Assert(err, Equals, syscall.ENOENT)

renameOp := fuseops.RenameOp{
OldParent: root.Id,
NewParent: root.Id,
OldName: "file1",
NewName: "newfile",
}

err = s.fs.Rename(nil, &renameOp)
err = root.Rename("file1", root, "newfile")
t.Assert(err, IsNil)

lookupOp1.Entry = fuseops.ChildInodeEntry{}
Expand Down

0 comments on commit 8287e1b

Please sign in to comment.