]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_cls_rbd: get_parent with no parent: should fail and return null-pspec
authorDan Mick <dan.mick@inktank.com>
Fri, 17 Aug 2012 20:07:04 +0000 (13:07 -0700)
committerDan Mick <dan.mick@inktank.com>
Sat, 18 Aug 2012 01:31:51 +0000 (18:31 -0700)
src/test/rbd/test_cls_rbd.cc

index 22a3b415c46098cef6b2e950b78c6b60dc01fd8b..408c068a7903ee7a6d396bfed3885632512d0a2e 100644 (file)
@@ -551,8 +551,12 @@ TEST(cls_rbd, parents)
 
   // old image should fail
   ASSERT_EQ(0, create_image(&ioctx, "old", 33<<20, 22, 0, "old_blk."));
-  // this next test is no longer valid after 56bc369983e197d29496eb75bc3f7b9b05d98bf6
-  // ASSERT_EQ(-ENOEXEC, get_parent(&ioctx, "old", CEPH_NOSNAP, &pspec, &size));
+  // get nonexistent parent: succeed, return (-1, "", CEPH_NOSNAP), overlap 0
+  ASSERT_EQ(0, get_parent(&ioctx, "old", CEPH_NOSNAP, &pspec, &size));
+  ASSERT_EQ(pspec.pool_id, -1);
+  ASSERT_STREQ("", pspec.image_id.c_str());
+  ASSERT_EQ(pspec.snap_id, CEPH_NOSNAP);
+  ASSERT_EQ(size, 0ULL);
   pspec = parent_spec(-1, "parent", 3);
   ASSERT_EQ(-ENOEXEC, set_parent(&ioctx, "old", parent_spec(-1, "parent", 3), 10<<20));
   ASSERT_EQ(-ENOEXEC, remove_parent(&ioctx, "old"));