From 1cf018d11ed7ec255da123eda35d33e1bf67ed7c Mon Sep 17 00:00:00 2001 From: zhanglei <243290414@qq.com> Date: Fri, 19 May 2017 05:40:02 -0400 Subject: [PATCH] Check apply_transaction return values Signed-off-by: zhanglei <243290414@qq.com> --- src/test/objectstore/store_test.cc | 31 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 19ea9d7ca88..eabe7f1c026 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -4646,7 +4646,8 @@ TEST_P(StoreTest, OMapTest) { t.omap_clear(cid, hoid); map start_set; t.omap_setkeys(cid, hoid, start_set); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); } for (int i = 0; i < 100; i++) { @@ -4681,7 +4682,8 @@ TEST_P(StoreTest, OMapTest) { to_add.insert(pair("key-" + string(buf), bl)); attrs.insert(pair("key-" + string(buf), bl)); t.omap_setkeys(cid, hoid, to_add); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); } int i = 0; @@ -4711,7 +4713,8 @@ TEST_P(StoreTest, OMapTest) { set keys_to_remove; keys_to_remove.insert(to_remove); t.omap_rmkeys(cid, hoid, keys_to_remove); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); attrs.erase(to_remove); @@ -4723,7 +4726,8 @@ TEST_P(StoreTest, OMapTest) { bl1.append("omap_header"); ObjectStore::Transaction t; t.omap_setheader(cid, hoid, bl1); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); t = ObjectStore::Transaction(); bufferlist bl2; @@ -4731,7 +4735,8 @@ TEST_P(StoreTest, OMapTest) { map to_add; to_add.insert(pair("key", bl2)); t.omap_setkeys(cid, hoid, to_add); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); bufferlist bl3; map cur_attrs; @@ -4760,12 +4765,14 @@ TEST_P(StoreTest, OMapTest) { t.touch(cid, hoid); t.omap_setheader(cid, hoid, h); t.omap_setkeys(cid, hoid, to_set); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.omap_rmkeyrange(cid, hoid, "3", "7"); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); } { bufferlist hdr; @@ -4783,7 +4790,8 @@ TEST_P(StoreTest, OMapTest) { { ObjectStore::Transaction t; t.omap_clear(cid, hoid); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); } { bufferlist hdr; @@ -4821,7 +4829,8 @@ TEST_P(StoreTest, OMapIterator) { t.omap_clear(cid, hoid); map start_set; t.omap_setkeys(cid, hoid, start_set); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); } ObjectMap::ObjectMapIterator iter; bool correct; @@ -4864,7 +4873,8 @@ TEST_P(StoreTest, OMapIterator) { attrs.insert(pair("key-" + string(buf), bl)); ObjectStore::Transaction t; t.omap_setkeys(cid, hoid, to_add); - apply_transaction(store, &osr, std::move(t)); + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); } iter = store->get_omap_iterator(cid, hoid); @@ -6324,6 +6334,7 @@ TEST_P(StoreTestSpecificAUSize, SmallWriteOnShardedExtents) { t.write(cid, hoid1, 0, bl2.length(), bl2, 0); t.zero(cid, hoid1, 0, 0x50000); r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); } store->umount();