Uses random paths with slashes for storagedriver tests, adds edge cases
This replaces only using flat filenames, to better test nested file behaviors. Fixed inmemory/mfs.go and filesystem/driver.go after finding bugs with the new tests and test behavior.
This commit is contained in:
parent
9e38ca2231
commit
cacf33ab62
3 changed files with 186 additions and 59 deletions
|
@ -210,7 +210,7 @@ func (d *dir) move(src, dst string) error {
|
|||
srcDirname, srcFilename := path.Split(src)
|
||||
sp := d.find(srcDirname)
|
||||
|
||||
if sp.path() != srcDirname {
|
||||
if srcDirname != strings.TrimSuffix(sp.path(), "/")+"/" {
|
||||
return errNotExists
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ func (d *dir) delete(p string) error {
|
|||
dirname, filename := path.Split(p)
|
||||
parent := d.find(dirname)
|
||||
|
||||
if dirname != parent.path() {
|
||||
if dirname != strings.TrimSuffix(parent.path(), "/")+"/" {
|
||||
return errNotExists
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue