mirror of https://github.com/ceph/go-ceph
rados: adds null oid coverage to omap related tests
Previous changes added support for operating on omap keys that include null characters (e.g. rados_omap_get_next2, rados_write_op_omap_rm_keys2). This change adds some basic test coverage those operations' null character support. Signed-off-by: Nick Janus <github@nondesignated.com>
This commit is contained in:
parent
52182d0103
commit
e1f75a459d
|
@ -892,6 +892,7 @@ func (suite *RadosTestSuite) TestReadWriteOmap() {
|
||||||
"key1": []byte("value1"),
|
"key1": []byte("value1"),
|
||||||
"key2": []byte("value2"),
|
"key2": []byte("value2"),
|
||||||
"prefixed-key3": []byte("value3"),
|
"prefixed-key3": []byte("value3"),
|
||||||
|
"null\x00key4": []byte("value4"),
|
||||||
"empty": []byte(""),
|
"empty": []byte(""),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,7 +906,7 @@ func (suite *RadosTestSuite) TestReadWriteOmap() {
|
||||||
remaining[k] = v
|
remaining[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
err = suite.ioctx.ListOmapValues(oid, "", "", 4, func(key string, value []byte) {
|
err = suite.ioctx.ListOmapValues(oid, "", "", 5, func(key string, value []byte) {
|
||||||
assert.Equal(suite.T(), remaining[key], value)
|
assert.Equal(suite.T(), remaining[key], value)
|
||||||
delete(remaining, key)
|
delete(remaining, key)
|
||||||
})
|
})
|
||||||
|
@ -914,7 +915,7 @@ func (suite *RadosTestSuite) TestReadWriteOmap() {
|
||||||
assert.Equal(suite.T(), len(remaining), 0)
|
assert.Equal(suite.T(), len(remaining), 0)
|
||||||
|
|
||||||
// Get (with a fixed number of keys)
|
// Get (with a fixed number of keys)
|
||||||
fetched, err := suite.ioctx.GetOmapValues(oid, "", "", 4)
|
fetched, err := suite.ioctx.GetOmapValues(oid, "", "", 5)
|
||||||
assert.NoError(suite.T(), err)
|
assert.NoError(suite.T(), err)
|
||||||
assert.Equal(suite.T(), orig, fetched)
|
assert.Equal(suite.T(), orig, fetched)
|
||||||
|
|
||||||
|
@ -924,15 +925,15 @@ func (suite *RadosTestSuite) TestReadWriteOmap() {
|
||||||
assert.Equal(suite.T(), orig, fetched)
|
assert.Equal(suite.T(), orig, fetched)
|
||||||
|
|
||||||
// Get All (with an iterator size smaller than the map size)
|
// Get All (with an iterator size smaller than the map size)
|
||||||
fetched, err = suite.ioctx.GetAllOmapValues(oid, "", "", 1)
|
fetched, err = suite.ioctx.GetAllOmapValues(oid, "", "", 2)
|
||||||
assert.NoError(suite.T(), err)
|
assert.NoError(suite.T(), err)
|
||||||
assert.Equal(suite.T(), orig, fetched)
|
assert.Equal(suite.T(), orig, fetched)
|
||||||
|
|
||||||
// Remove
|
// Remove
|
||||||
err = suite.ioctx.RmOmapKeys(oid, []string{"key1", "prefixed-key3"})
|
err = suite.ioctx.RmOmapKeys(oid, []string{"key1", "prefixed-key3", "null\x00key4"})
|
||||||
assert.NoError(suite.T(), err)
|
assert.NoError(suite.T(), err)
|
||||||
|
|
||||||
fetched, err = suite.ioctx.GetOmapValues(oid, "", "", 4)
|
fetched, err = suite.ioctx.GetOmapValues(oid, "", "", 5)
|
||||||
assert.NoError(suite.T(), err)
|
assert.NoError(suite.T(), err)
|
||||||
assert.Equal(suite.T(), map[string][]byte{
|
assert.Equal(suite.T(), map[string][]byte{
|
||||||
"key2": []byte("value2"),
|
"key2": []byte("value2"),
|
||||||
|
|
Loading…
Reference in New Issue