From 851aa638772b0bffdbd3441ac729ce9070b3b764 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Fri, 13 Oct 2017 10:13:40 +0300 Subject: [PATCH] test/librbd: test metadata_set/remove is applied Signed-off-by: Mykola Golub --- src/test/librbd/test_internal.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc index 7cc6e12cab9b9..f3c5d28b0d213 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); -- 2.39.5