aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexei Frolov <frolv@google.com>2023-11-14 00:12:41 +0000
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-11-14 00:12:41 +0000
commit6ec8e692dc12eac625f9d1f12ecd57b1a2e5cbc0 (patch)
treecea00a6b2fd20cab4546ffdb23f3278419de205e
parent32e50427e7ff68e201dbdbd0e6ea921caf17b470 (diff)
downloadpigweed-6ec8e692dc12eac625f9d1f12ecd57b1a2e5cbc0.tar.gz
pw_transfer: Limit data sent in manual cancel test
The manual cancellation unit test was requesting that the client send all of its available data, which could sometimes lead to flakes as it would initiate the closing handshake early. This updates the test to only prompt the client for a smaller data chunk. Change-Id: I2ba339fe017431c85714fd7a122c695254770915 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/180826 Reviewed-by: Keir Mierle <keir@google.com> Pigweed-Auto-Submit: Alexei Frolov <frolv@google.com> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Chinchilla <cachinchilla@google.com>
-rw-r--r--pw_transfer/client_test.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/pw_transfer/client_test.cc b/pw_transfer/client_test.cc
index d1cf3229f..323570dcf 100644
--- a/pw_transfer/client_test.cc
+++ b/pw_transfer/client_test.cc
@@ -1581,12 +1581,14 @@ TEST_F(WriteTransfer, ManualCancel) {
EXPECT_EQ(chunk.type(), Chunk::Type::kStart);
// Get a response from the server, then cancel the transfer.
+ // This must request a smaller chunk than the entire available write data to
+ // prevent the client from trying to send an additional finish chunk.
context_.server().SendServerStream<Transfer::Write>(EncodeChunk(
Chunk(ProtocolVersion::kLegacy, Chunk::Type::kParametersRetransmit)
.set_session_id(15)
.set_offset(0)
- .set_window_end_offset(64)
- .set_max_chunk_size_bytes(32)));
+ .set_window_end_offset(16)
+ .set_max_chunk_size_bytes(16)));
transfer_thread_.WaitUntilEventIsProcessed();
ASSERT_EQ(payloads.size(), 2u);