From 5d79dd9718e5e7f05be932c81723c8963c685a68 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Wed, 3 Dec 2014 21:05:18 -0800 Subject: [PATCH] test: make read/write test simpler Signed-off-by: Noah Watkins --- rados_test.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/rados_test.go b/rados_test.go index 71fb736..048696a 100644 --- a/rados_test.go +++ b/rados_test.go @@ -11,7 +11,6 @@ import "io/ioutil" import "time" import "net" import "fmt" -import "crypto/rand" func GetUUID() string { out, _ := exec.Command("uuidgen").Output() @@ -294,17 +293,13 @@ func TestReadWrite(t *testing.T) { pool, err := conn.OpenPool(pool_name) assert.NoError(t, err) - // make random bytes - bytes := make([]byte, 1<<20) - n, err := rand.Read(bytes) + bytes_in := []byte("input data") + err = pool.Write("obj", bytes_in, 0) assert.NoError(t, err) - err = pool.Write("obj", bytes, 0) - assert.NoError(t, err) - - bytes_out := make([]byte, 1<<20) + bytes_out := make([]byte, len(bytes_in)) n_out, err := pool.Read("obj", bytes_out, 0) - assert.Equal(t, n, n_out) - assert.Equal(t, bytes, bytes_out) + assert.Equal(t, n_out, len(bytes_in)) + assert.Equal(t, bytes_in, bytes_out) }