-TEST(CrushWrapper, class_is_in_use) {
- CrushWrapper c;
- c.create();
- c.set_type_name(1, "root");
-
- int weight = 1;
- map<string,string> loc;
- loc["root"] = "default";
-
- ASSERT_FALSE(c.class_is_in_use(0));
-
- int item = 1;
- c.insert_item(g_ceph_context, item, weight, "osd.1", loc);
- int class_id = c.get_or_create_class_id("ssd");
- c.class_map[item] = class_id;
-
- ASSERT_TRUE(c.class_is_in_use(c.get_class_id("ssd")));
- ASSERT_EQ(0, c.remove_class_name("ssd"));
- ASSERT_FALSE(c.class_is_in_use(c.get_class_id("ssd")));
-}
-