masaori335 commented on code in PR #11178:
URL: https://github.com/apache/trafficserver/pull/11178#discussion_r1577381413


##########
src/iocore/cache/unit_tests/test_Stripe.cc:
##########
@@ -157,3 +256,54 @@ TEST_CASE("The behavior of Stripe::add_writer.")
     }
   }
 }
+
+// This test case demonstrates how to set up a Stripe and make
+// a call to aggWrite without causing memory errors. It uses a
+// tmpfile for the Stripe to write to.
+TEST_CASE("aggWrite behavior")
+{
+  Stripe stripe;
+  StripteHeaderFooter header;
+  CacheVol cache_vol;
+  init_stripe_for_writing(stripe, header, cache_vol);
+  WaitingVC vc{&stripe};
+  vc.set_write_len(1);
+  vc.set_agg_len(stripe.round_to_approx_size(vc.write_len + vc.header_len + 
vc.frag_len));
+  stripe.add_writer(&vc);
+
+  SECTION("Given the aggregation buffer is only partially full and no sync, "
+          "when we call aggWrite, "
+          "then nothing should be written to disk.")
+  {
+    header.agg_pos = 0;
+    {
+      SCOPED_MUTEX_LOCK(lock, stripe.mutex, this_ethread());
+      stripe.aggWrite(0, 0);

Review Comment:
   I'd like `EVENT_NONE` for the first argument.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to