Skip to content

Commit

Permalink
Improve Fsetstat test case
Browse files Browse the repository at this point in the history
  • Loading branch information
drakkan committed Aug 25, 2020
1 parent b6bdd77 commit e9958cb
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions request-server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,26 +355,23 @@ func TestRequestFsetstat(t *testing.T) {
require.NoError(t, err)
err = fp.Truncate(2)
require.NoError(t, err)
err = fp.Truncate(5)
require.NoError(t, err)
fi, err := fp.Stat()
if assert.NoError(t, err) {
assert.Equal(t, fi.Name(), "foo")
assert.Equal(t, fi.Size(), int64(2))
assert.Equal(t, fi.Size(), int64(5))
}
_, err = fp.Seek(int64(2), io.SeekStart)
assert.NoError(t, err)
n, err := fp.Write([]byte("hello"))
assert.NoError(t, err)
assert.Equal(t, 5, n)
err = fp.Close()
assert.NoError(t, err)
rf, err := p.cli.Open("/foo")
assert.NoError(t, err)
defer rf.Close()
contents := make([]byte, 20)
n, err = rf.Read(contents)
n, err := rf.Read(contents)
assert.EqualError(t, err, io.EOF.Error())
assert.Equal(t, 2+5, n)
assert.Equal(t, "hehello", string(contents[0:n]))
assert.Equal(t, 5, n)
assert.Equal(t, []byte{'h', 'e', 0, 0, 0}, contents[0:n])
checkRequestServerAllocator(t, p)
}

Expand Down

0 comments on commit e9958cb

Please sign in to comment.