mirror of https://github.com/ceph/go-ceph
rbd/tests: add special "read 0 bytes" case
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
a0fcd9202c
commit
f170634d82
|
@ -557,8 +557,14 @@ func TestIOReaderWriter(t *testing.T) {
|
|||
_, err = img.Seek(0, SeekSet)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// reading 0 bytes should succeed
|
||||
nil_bytes := make([]byte, 0)
|
||||
n_out, err := img.Read(nil_bytes)
|
||||
assert.Equal(t, n_out, 0)
|
||||
assert.NoError(t, err)
|
||||
|
||||
bytes_out := make([]byte, len(bytes_in))
|
||||
n_out, err := img.Read(bytes_out)
|
||||
n_out, err = img.Read(bytes_out)
|
||||
|
||||
assert.Equal(t, n_out, len(bytes_in))
|
||||
assert.Equal(t, bytes_in, bytes_out)
|
||||
|
|
Loading…
Reference in New Issue