]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
src/test: clean up ec test cases
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 4 Aug 2020 13:26:06 +0000 (22:26 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 18 Aug 2020 16:38:17 +0000 (01:38 +0900)
Use write_full to create an object and adjust test
scenario because all dirty chunks do not lead to flush

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsumg.com>
src/test/librados/tier_cxx.cc

index 7f4bdb3cba02341a7ba19d83e7b8420bfa17a6b9..77c81c55e9f6770a06385a47fe5806958fd3424b 100644 (file)
@@ -7498,35 +7498,33 @@ TEST_F(LibRadosTwoPoolsECPP, SetRedirectRead) {
 TEST_F(LibRadosTwoPoolsECPP, SetChunkRead) {
   // note: require >= mimic
 
-  // create object
+  bufferlist inbl;
+  ASSERT_EQ(0, cluster.mon_command(
+    set_pool_str(pool_name, "allow_ec_overwrites", "true"),
+    inbl, NULL, NULL));
   {
+    bufferlist bl;
+    bl.append("there hi");
     ObjectWriteOperation op;
-    op.create(true);
+    op.write_full(bl);
     ASSERT_EQ(0, ioctx.operate("foo", &op));
   }
+
   {
     bufferlist bl;
-    bl.append("hi there");
+    bl.append("There hi");
     ObjectWriteOperation op;
     op.write_full(bl);
     ASSERT_EQ(0, cache_ioctx.operate("bar", &op));
   }
 
-  // configure tier
-  bufferlist inbl;
-  ASSERT_EQ(0, cluster.mon_command(
-    "{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
-    "\", \"tierpool\": \"" + cache_pool_name +
-    "\", \"force_nonempty\": \"--force-nonempty\" }",
-    inbl, NULL, NULL));
-
   // wait for maps to settle
   cluster.wait_for_latest_osdmap();
 
   // set_chunk
   {
     ObjectReadOperation op;
-    op.set_chunk(0, 8, cache_ioctx, "bar", 0);
+    op.set_chunk(0, 4, cache_ioctx, "bar", 0);
     librados::AioCompletion *completion = cluster.aio_create_completion();
     ASSERT_EQ(0, ioctx.aio_operate("foo", completion, &op,
              librados::OPERATION_IGNORE_CACHE, NULL));
@@ -7535,13 +7533,15 @@ TEST_F(LibRadosTwoPoolsECPP, SetChunkRead) {
     completion->release();
   }
 
-  // make all chunks dirty --> full flush --> all chunks are evicted
+  // promote
   {
-    bufferlist bl;
-    bl.append("There hi");
     ObjectWriteOperation op;
-    op.write_full(bl);
-    ASSERT_EQ(0, ioctx.operate("foo", &op));
+    op.tier_promote();
+    librados::AioCompletion *completion = cluster.aio_create_completion();
+    ASSERT_EQ(0, ioctx.aio_operate("foo", completion, &op));
+    completion->wait_for_complete();
+    ASSERT_EQ(0, completion->get_return_value());
+    completion->release();
   }
 
   // read and verify the object
@@ -7551,11 +7551,6 @@ TEST_F(LibRadosTwoPoolsECPP, SetChunkRead) {
     ASSERT_EQ('T', bl[0]);
   }
 
-  ASSERT_EQ(0, cluster.mon_command(
-    "{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
-    "\", \"tierpool\": \"" + cache_pool_name + "\"}",
-    inbl, NULL, NULL));
-
   // wait for maps to settle before next test
   cluster.wait_for_latest_osdmap();
 }
@@ -7563,22 +7558,29 @@ TEST_F(LibRadosTwoPoolsECPP, SetChunkRead) {
 TEST_F(LibRadosTwoPoolsECPP, ManifestPromoteRead) {
   // note: require >= mimic
 
+  bufferlist inbl;
+  ASSERT_EQ(0, cluster.mon_command(
+    set_pool_str(pool_name, "allow_ec_overwrites", "true"),
+    inbl, NULL, NULL));
+
   // create object
   {
     bufferlist bl;
-    bl.append("hi there");
+    bl.append("hiaa there");
     ObjectWriteOperation op;
     op.write_full(bl);
     ASSERT_EQ(0, ioctx.operate("foo", &op));
   }
   {
+    bufferlist bl;
+    bl.append("base chunk");
     ObjectWriteOperation op;
-    op.create(true);
+    op.write_full(bl);
     ASSERT_EQ(0, ioctx.operate("foo-chunk", &op));
   }
   {
     bufferlist bl;
-    bl.append("HI there");
+    bl.append("HIaa there");
     ObjectWriteOperation op;
     op.write_full(bl);
     ASSERT_EQ(0, cache_ioctx.operate("bar", &op));
@@ -7591,17 +7593,6 @@ TEST_F(LibRadosTwoPoolsECPP, ManifestPromoteRead) {
     ASSERT_EQ(0, cache_ioctx.operate("bar-chunk", &op));
   }
 
-  // configure tier
-  bufferlist inbl;
-  ASSERT_EQ(0, cluster.mon_command(
-    "{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
-    "\", \"tierpool\": \"" + cache_pool_name +
-    "\", \"force_nonempty\": \"--force-nonempty\" }",
-    inbl, NULL, NULL));
-
-  // wait for maps to settle
-  cluster.wait_for_latest_osdmap();
-
   // set-redirect
   {
     ObjectWriteOperation op;
@@ -7656,11 +7647,6 @@ TEST_F(LibRadosTwoPoolsECPP, ManifestPromoteRead) {
     ASSERT_EQ('B', bl[0]);
   }
 
-  ASSERT_EQ(0, cluster.mon_command(
-    "{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
-    "\", \"tierpool\": \"" + cache_pool_name + "\"}",
-    inbl, NULL, NULL));
-
   // wait for maps to settle before next test
   cluster.wait_for_latest_osdmap();
 }