]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librbd: test metadata_set/remove is applied 18288/head
authorMykola Golub <to.my.trociny@gmail.com>
Fri, 13 Oct 2017 07:13:40 +0000 (10:13 +0300)
committerMykola Golub <to.my.trociny@gmail.com>
Fri, 13 Oct 2017 07:16:35 +0000 (10:16 +0300)
Signed-off-by: Mykola Golub <to.my.trociny@gmail.com>
src/test/librbd/test_internal.cc

index 7cc6e12cab9b9ac0c5d07e88f0322f893d6627e2..f3c5d28b0d2138504aa568fda055293433ae4c56 100644 (file)
@@ -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);