From: Mykola Golub Date: Fri, 13 Oct 2017 07:13:40 +0000 (+0300) Subject: test/librbd: test metadata_set/remove is applied X-Git-Tag: v13.0.1~558^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F18288%2Fhead;p=ceph.git test/librbd: test metadata_set/remove is applied Signed-off-by: Mykola Golub --- diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc index 7cc6e12cab9..f3c5d28b0d2 100644 --- a/src/test/librbd/test_internal.cc +++ b/src/test/librbd/test_internal.cc @@ -548,6 +548,26 @@ TEST_F(TestInternal, MetadataFilter) { ASSERT_TRUE(res.size() == 3U); } +TEST_F(TestInternal, MetadataConfApply) { + REQUIRE_FEATURE(RBD_FEATURE_LAYERING); + + librbd::ImageCtx *ictx; + ASSERT_EQ(0, open_image(m_image_name, &ictx)); + + ASSERT_EQ(-ENOENT, ictx->operations->metadata_remove("conf_rbd_cache")); + + bool cache = ictx->cache; + std::string rbd_conf_cache = cache ? "true" : "false"; + std::string new_rbd_conf_cache = !cache ? "true" : "false"; + + ASSERT_EQ(0, ictx->operations->metadata_set("conf_rbd_cache", + new_rbd_conf_cache)); + ASSERT_EQ(!cache, ictx->cache); + + ASSERT_EQ(0, ictx->operations->metadata_remove("conf_rbd_cache")); + ASSERT_EQ(cache, ictx->cache); +} + TEST_F(TestInternal, SnapshotCopyup) { REQUIRE_FEATURE(RBD_FEATURE_LAYERING);