Skip to content

Commit 9518de0

Browse files
committed
test(storage): align max redirect test with googleapis#7200
1 parent a349445 commit 9518de0

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

‎src/storage/tests/open_object_grpc.rs‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ fn single_range(request: &BidiReadObjectRequest) -> ProtoRange {
512512
mod conformance {
513513
use super::*;
514514
use google_cloud_gax::error::rpc::Code;
515-
use google_cloud_gax::retry_policy::{AlwaysRetry, NeverRetry, RetryPolicyExt as _};
515+
use google_cloud_gax::retry_policy::NeverRetry;
516516
use google_cloud_storage::error::ReadError;
517517
use google_cloud_storage::model_ext::KeyAes256;
518518
use google_cloud_storage::read_resume_policy::{
@@ -726,8 +726,10 @@ mod conformance {
726726
}
727727

728728
/// Verifies redirect limit enforcement when the server repeatedly returns redirects,
729-
/// confirming the client stops retrying once the attempt budget is exhausted.
729+
/// ensuring the client terminates with an error after reaching the maximum attempt bound.
730+
// TODO(#7200) - disabled until consecutive redirect cap is implemented for bidi read.
730731
#[tokio::test]
732+
#[ignore = "TODO(#7200) - bidi read does not yet enforce a consecutive redirect limit"]
731733
async fn handle_redirect_error_max_attempts() -> anyhow::Result<()> {
732734
// Arrange: Mock fails every attempt with a redirect
733735
let attempts = Arc::new(AtomicUsize::new(0));
@@ -741,19 +743,13 @@ mod conformance {
741743

742744
let (client, _server) = start_test_server(mock).await?;
743745

744-
// Act: Set retry policy with attempt limit of 2
745-
let result = client
746-
.open_object(BUCKET_NAME, OBJECT_NAME)
747-
.with_retry_policy(AlwaysRetry.with_attempt_limit(2))
748-
.send()
749-
.await;
746+
// Act: Open object descriptor with default client settings
747+
let result = client.open_object(BUCKET_NAME, OBJECT_NAME).send().await;
750748

751-
// Assert: Call fails with error after reaching max attempts
752-
assert!(
753-
result.is_err(),
754-
"expected error after max redirect attempts"
755-
);
756-
assert_eq!(attempts.load(Ordering::SeqCst), 2);
749+
// Assert: Call fails with error after reaching max redirect limit (4 attempts: 1 initial + 3 redirects)
750+
let err = result.expect_err("expected error after max redirect attempts");
751+
assert_eq!(err.status().map(|s| s.code), Some(Code::Aborted));
752+
assert_eq!(attempts.load(Ordering::SeqCst), 4);
757753

758754
Ok(())
759755
}

0 commit comments

Comments
 (0)