From 882b370052f54b03ed9eb053f9a4c7ec9aec6074 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 14 Apr 2015 09:40:11 -0400 Subject: [PATCH] tests: verify RBD flags are updated when enabling/disabling features Signed-off-by: Jason Dillaman --- src/test/librbd/test_librbd.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index d6f676dbd4d..134a08bde80 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -2887,13 +2887,27 @@ TEST_F(TestLibRBD, UpdateFeatures) ASSERT_EQ(0, image.update_features(RBD_FEATURE_OBJECT_MAP | RBD_FEATURE_FAST_DIFF, true)); + uint64_t expected_flags = RBD_FLAG_OBJECT_MAP_INVALID | + RBD_FLAG_FAST_DIFF_INVALID; + uint64_t flags; + ASSERT_EQ(0, image.get_flags(&flags)); + ASSERT_EQ(expected_flags, flags); + // cannot disable object map w/ fast diff ASSERT_EQ(-EINVAL, image.update_features(RBD_FEATURE_OBJECT_MAP, false)); ASSERT_EQ(0, image.update_features(RBD_FEATURE_FAST_DIFF, false)); + expected_flags = RBD_FLAG_OBJECT_MAP_INVALID; + ASSERT_EQ(0, image.get_flags(&flags)); + ASSERT_EQ(expected_flags, flags); + // cannot disable exclusive lock w/ object map ASSERT_EQ(-EINVAL, image.update_features(RBD_FEATURE_EXCLUSIVE_LOCK, false)); ASSERT_EQ(0, image.update_features(RBD_FEATURE_OBJECT_MAP, false)); + + ASSERT_EQ(0, image.get_flags(&flags)); + ASSERT_EQ(0U, flags); + ASSERT_EQ(0, image.update_features(RBD_FEATURE_EXCLUSIVE_LOCK, false)); }