diff --git a/services/commtest/tests/blob/get.rs b/services/commtest/tests/blob/get.rs new file mode 100644 --- /dev/null +++ b/services/commtest/tests/blob/get.rs @@ -0,0 +1,29 @@ +#[path = "./blob_utils.rs"] +mod blob_utils; +#[path = "../lib/tools.rs"] +mod tools; + +use tonic::Request; + +use crate::blob_utils::{proto::GetRequest, BlobData, BlobServiceClient}; +use crate::tools::Error; + +pub async fn run( + client: &mut BlobServiceClient, + blob_data: &BlobData, +) -> Result, Error> { + let cloned_holder = blob_data.holder.clone(); + println!("get {}", cloned_holder); + + let response = client + .get(Request::new(GetRequest { + holder: cloned_holder, + })) + .await?; + let mut inbound = response.into_inner(); + let mut sizes: Vec = Vec::new(); + while let Some(response) = inbound.message().await? { + sizes.push(response.data_chunk.len()); + } + Ok(sizes) +}