This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 9df3319a65 fix(bindings/cpp): align retry read test with EOF retry
semantics (#8839)
9df3319a65 is described below
commit 9df3319a65fabc7f99d50f5d97db30ba0fcd9234
Author: Xuanwo <[email protected]>
AuthorDate: Mon Nov 23 15:33:26 2026 +0800
fix(bindings/cpp): align retry read test with EOF retry semantics (#8839)
`RetryReadStream` ends a read when a temporary error arrives after the
resolved range is exhausted, instead of reopening the empty range left
over. The retryable mock stream is therefore read four times, not five.
#8816 updated the core tests for this behavior, but the C++ binding test
still asserted the old count and failed on main.
---
bindings/cpp/src/test_support.rs | 2 ++
bindings/cpp/tests/layer_test.cpp | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/bindings/cpp/src/test_support.rs b/bindings/cpp/src/test_support.rs
index 380df87858..5522dd358f 100644
--- a/bindings/cpp/src/test_support.rs
+++ b/bindings/cpp/src/test_support.rs
@@ -297,6 +297,8 @@ impl oio::ReadStream for RetryableReadStream {
let mut attempt = self.attempt.lock().unwrap();
*attempt += 1;
+ // Two failures, then the full content, then a failure at EOF. Attempt
5
+ // is only reached if the layer reopens the range it has exhausted.
match *attempt {
1 | 2 | 4 => Err(
Error::new(ErrorKind::Unexpected, "retryable_error from
reader").set_temporary(),
diff --git a/bindings/cpp/tests/layer_test.cpp
b/bindings/cpp/tests/layer_test.cpp
index 434ccedd48..45aa3fc291 100644
--- a/bindings/cpp/tests/layer_test.cpp
+++ b/bindings/cpp/tests/layer_test.cpp
@@ -71,7 +71,9 @@ OPENDAL_TEST_F(LayerTest,
RetryReadSucceedsAfterTransientFailures) {
MockOperator op(FastRetryOptions(), MockBackendKind::Retryable);
EXPECT_EQ(op.Read("retryable_error"), "Hello, World!");
- EXPECT_EQ(MockOperator::RetryAttemptCount(), 5U);
+ // Two retries, then the full read. The temporary error at EOF ends the
+ // stream without another open.
+ EXPECT_EQ(MockOperator::RetryAttemptCount(), 4U);
}
OPENDAL_TEST_F(LayerTest, RetryExhaustsConfiguredMaxTimes) {