go-ceph/rados/ioctx_set_alloc_hint_test.go
Quentin Devos 5f38b5422e rados: Implement rados_set_alloc_hint2
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
2022-07-06 17:56:39 +00:00

27 lines
755 B
Go

package rados
import (
"github.com/stretchr/testify/assert"
)
func (suite *RadosTestSuite) TestSetAllocationHint() {
suite.SetupConnection()
ta := assert.New(suite.T())
oid := "TestSetAllocationHint"
data := []byte("write this")
ioctx, err := suite.conn.OpenIOContext(suite.pool)
ta.NoError(err)
err = ioctx.SetAllocationHint(oid, 4096, 20, AllocHintCompressible|AllocHintLonglived|AllocHintRandomRead|AllocHintSequentialWrite)
ta.NoError(err)
err = ioctx.WriteFull(oid, []byte(data))
ta.NoError(err)
err = ioctx.SetAllocationHint(oid, 128, 128, AllocHintShortlived|AllocHintAppendOnly)
ta.NoError(err)
err = ioctx.Append(oid, []byte(data))
ta.NoError(err)
err = ioctx.SetAllocationHint(oid, 20, 0, AllocHintNoHint)
ta.NoError(err)
}