mirror of
https://github.com/ceph/go-ceph
synced 2024-12-18 12:25:22 +00:00
863d71caa5
These apis are now stable as per the stability plan. Signed-off-by: John Mulligan <jmulligan@redhat.com>
30 lines
688 B
Go
30 lines
688 B
Go
package rados
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func (suite *RadosTestSuite) TestWriteOpSetXattr() {
|
|
suite.SetupConnection()
|
|
ta := assert.New(suite.T())
|
|
|
|
var (
|
|
oid = "TestWriteOpSetXattr"
|
|
xattrName = "attrname"
|
|
xattrValue = []byte("attrvalue")
|
|
)
|
|
|
|
// Create an object and populate it with data.
|
|
op1 := CreateWriteOp()
|
|
defer op1.Release()
|
|
op1.Create(CreateIdempotent)
|
|
op1.SetXattr(xattrName, xattrValue)
|
|
err := op1.Operate(suite.ioctx, oid, OperationNoFlag)
|
|
ta.NoError(err)
|
|
|
|
// Read object's xattrs and compare.
|
|
actualXattrs, err := suite.ioctx.ListXattrs(oid)
|
|
ta.NoError(err)
|
|
ta.Equal(map[string][]byte{xattrName: xattrValue}, actualXattrs)
|
|
}
|