]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_test_rados_misc: test bad version for copy-from
authorSage Weil <sage@inktank.com>
Sun, 5 Jan 2014 20:26:48 +0000 (12:26 -0800)
committerSage Weil <sage@inktank.com>
Tue, 14 Jan 2014 00:19:48 +0000 (16:19 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
src/test/librados/misc.cc

index bbe67ea0b5aa542ff732ece6431596592984a6f1..0b2ba6ccf12d4df72b5fbb82dcae88bd0801df96 100644 (file)
@@ -663,9 +663,22 @@ TEST(LibRadosMisc, CopyPP) {
   ASSERT_EQ(0, ioctx.write_full("foo", blc));
   ASSERT_EQ(0, ioctx.setxattr("foo", "myattr", xc));
 
+  version_t uv = ioctx.get_last_version();
   {
+    // pass future version
     ObjectWriteOperation op;
-    op.copy_from("foo", ioctx, ioctx.get_last_version());
+    op.copy_from("foo", ioctx, uv + 1);
+    ASSERT_EQ(-EOVERFLOW, ioctx.operate("foo.copy", &op));
+  }
+  {
+    // pass old version
+    ObjectWriteOperation op;
+    op.copy_from("foo", ioctx, uv - 1);
+    ASSERT_EQ(-ERANGE, ioctx.operate("foo.copy", &op));
+  }
+  {
+    ObjectWriteOperation op;
+    op.copy_from("foo", ioctx, uv);
     ASSERT_EQ(0, ioctx.operate("foo.copy", &op));
 
     bufferlist bl2, x2;