Skip to content

Commit

Permalink
Nail down the current behavior of listing conflicting names with a test.
Browse files Browse the repository at this point in the history
For #28.
  • Loading branch information
jacobsa committed Mar 27, 2015
1 parent b10cb4c commit e56cd77
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fs/fstesting/foreign_modifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ func (t *foreignModsTest) UnreachableObjects() {

func (t *foreignModsTest) FileAndDirectoryWithConflictingName() {
var fi os.FileInfo
var entries []os.FileInfo
var err error

// Set up an object named "foo" and one named "foo/", plus a child for the
Expand Down Expand Up @@ -366,6 +367,23 @@ func (t *foreignModsTest) FileAndDirectoryWithConflictingName() {
ExpectEq("foo", fi.Name())
ExpectEq(4, fi.Size())
ExpectFalse(fi.IsDir())

// Listing the directory will result in both.
//
// This behavior is a bug.
// Cf. https://github.com/GoogleCloudPlatform/gcsfuse/issues/28
entries, err = ioutil.ReadDir(t.mfs.Dir())
AssertEq(nil, err)
AssertEq(2, len(entries))

ExpectEq("foo", entries[0].Name())
ExpectEq("foo", entries[1].Name())

ExpectThat([]int64{entries[0].Size(), entries[1].Size()}, Contains(4))

// This is also a bug.
ExpectFalse(entries[0].IsDir())
ExpectFalse(entries[1].IsDir())
}

func (t *foreignModsTest) Inodes() {
Expand Down

0 comments on commit e56cd77

Please sign in to comment.