From ad28b727b83f43452e271c600bf31d248eae6de7 Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Sun, 12 Oct 2025 15:32:11 +0200 Subject: [PATCH] chore: Update image roundtrip test - image roundtrip test fails due to the sporadic, but often, 403 returned by the remote. - implement image download retry mechanism. - update cirros image to 0.6.3 --- .../tests/image/v2/image/file/roundtrip.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/openstack_cli/tests/image/v2/image/file/roundtrip.rs b/openstack_cli/tests/image/v2/image/file/roundtrip.rs index 1d79128d3..a64f79188 100644 --- a/openstack_cli/tests/image/v2/image/file/roundtrip.rs +++ b/openstack_cli/tests/image/v2/image/file/roundtrip.rs @@ -29,7 +29,16 @@ pub async fn download_with_md5_and_filename( url: &str, tmp_dir: &TempDir, ) -> Result<(PathBuf, String), Box> { - let client = Client::new(); + let retries = reqwest::retry::for_host("download.cirros-cloud.net") + .max_retries_per_request(3) + .classify_fn(|req_rep| { + if req_rep.status() == Some(http::StatusCode::FORBIDDEN) { + req_rep.retryable() + } else { + req_rep.success() + } + }); + let client = Client::builder().retry(retries).gzip(true).build()?; let response = client.get(url).send().await?; response.error_for_status_ref()?; // fail fast on HTTP errors @@ -88,7 +97,7 @@ fn extract_filename_from_url(url: &str) -> Option { #[tokio::test] async fn image_upload_download_roundtrip() -> Result<(), Box> { let tmp_dir = Builder::new().prefix("data").tempdir()?; - let cirros_ver = "0.6.2"; + let cirros_ver = "0.6.3"; let target = format!( "http://download.cirros-cloud.net/{ver}/cirros-{ver}-x86_64-disk.img", ver = cirros_ver @@ -97,7 +106,7 @@ async fn image_upload_download_roundtrip() -> Result<(), Box