]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-pybind-test: test embedded NULLs in data
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 25 May 2011 22:55:22 +0000 (15:55 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 25 May 2011 22:55:22 +0000 (15:55 -0700)
Test embedded nulls in rados data. Fix a bug in rados.Object.__str__

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/pybind/rados.py
src/test/ceph-pybind-test.py

index b4d663aab91cbc3294797e55a1bd89ea6be5bc81..d391d5f094b81c95c0db37072b61788d5bdf6242 100755 (executable)
@@ -502,7 +502,7 @@ class Object(object):
         self.state = "exists"
 
     def __str__(self):
-        return "rados.Object(ioctx=%s,key=%s)" % (str(self.ioctx), self.key.value)
+        return "rados.Object(ioctx=%s,key=%s)" % (str(self.ioctx), self.key)
 
     def require_object_exists(self):
         if self.state != "exists":
index a358868d878ea4e5c32bcf668d238d3845f292b2..c6096e890ec63f8e813c2f0531592ca76cb06837 100755 (executable)
@@ -60,6 +60,12 @@ got %s" % def_str)
 for obj in foo3_ioctx.list_objects():
     print str(obj)
 
+foo3_ioctx.write_full("ghi", "g\0h\0i")
+ghi_str = foo3_ioctx.read("ghi")
+if (ghi_str != "g\0h\0i"):
+    raise RuntimeError("error reading object ghi: expected value g\\0h\\0\i, \
+got %s" % (ghi_str))
+
 # do some things with extended attributes
 foo3_ioctx.set_xattr("abc", "a", "1")
 foo3_ioctx.set_xattr("def", "b", "2")