Skip to content

Commit

Permalink
httpfs: test append, read
Browse files Browse the repository at this point in the history
  • Loading branch information
barnex committed Jan 8, 2015
1 parent 5b15fb1 commit f2e8aa5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions httpfs/httpfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,29 @@ func TestRemove(t *testing.T) {
}
}

func TestAppendRead(t *testing.T) {
Remove("testdata")
defer Remove("testdata")

mustPass(t, Mkdir("testdata"))

data := []byte("hello httpfs\n")
mustFail(t, Append("testdata/file", data)) // file does not exist yet

mustPass(t, Touch("testdata/file"))
for i := 0; i < MANYFILES; i++ {
mustPass(t, Append("testdata/file", data))
}

b, errR := Read("testdata/file")
if errR != nil {
t.Error(errR)
}
if len(b) != (MANYFILES)*len(data) {
t.Error(len(b), (MANYFILES+1)*len(data))
}
}

func mustPass(t *testing.T, err error) {
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit f2e8aa5

Please sign in to comment.