Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Update Rust azure_* dependencies #2500

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions src/agent/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/agent/onefuzz-task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ url = { version = "2.3", features = ["serde"] }
uuid = { version = "0.8", features = ["serde", "v4"] }
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }

azure_core = { version = "0.4", default-features = false, features = ["enable_reqwest_rustls"] }
azure_storage = { version = "0.5", default-features = false, features = ["enable_reqwest_rustls"] }
azure_storage_blobs = { version = "0.5", default-features = false, features = ["enable_reqwest_rustls"] }
azure_core = { version = "0.5", default-features = false, features = ["enable_reqwest_rustls"] }
azure_storage = { version = "0.6", default-features = false, features = ["enable_reqwest_rustls"] }
azure_storage_blobs = { version = "0.6", default-features = false, features = ["enable_reqwest_rustls"] }
31 changes: 14 additions & 17 deletions src/agent/onefuzz-task/src/tasks/task_logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use anyhow::{anyhow, Result};
use async_trait::async_trait;
use azure_core::error::HttpError;
use azure_core::StatusCode;
use azure_storage::prelude::StorageClient;
use azure_storage::StorageCredentials;
use azure_storage_blobs::container::operations::ListBlobsResponse;
use azure_storage_blobs::prelude::*;
use azure_storage_blobs::{container::operations::ListBlobsResponse, prelude::AsContainerClient};
use futures::TryStreamExt;
use onefuzz_telemetry::{LogTrace, LoggingEvent};
use reqwest::Url;
Expand Down Expand Up @@ -68,17 +68,17 @@ impl BlobLogWriter {
) -> Result<Self> {
let container_client = TaskLogger::create_container_client(&log_container)?;
let prefix = format!("{}/{}", task_id, machine_id);
let blob_list: Vec<ListBlobsResponse> = container_client
let pages: Vec<ListBlobsResponse> = container_client
.list_blobs()
.prefix(prefix.clone())
.into_stream()
.try_collect()
.await?;

let mut blob_ids: Vec<usize> = blob_list
.into_iter()
.flat_map(|lbr: ListBlobsResponse| lbr.blobs.blobs)
.filter_map(|b: Blob| {
let mut blob_ids: Vec<usize> = pages
.iter()
.flat_map(|p| p.blobs.blobs())
.filter_map(|b: &Blob| {
b.name
.strip_prefix(&prefix)
.map(PathBuf::from)
Expand Down Expand Up @@ -258,7 +258,8 @@ impl TaskLogger {
.query()
.ok_or(anyhow!("Invalid log container"))?;

let client = StorageClient::new_sas_token(account, sas_token)?;
let sas_credentials = StorageCredentials::sas_token(sas_token)?;
let client = BlobServiceClient::new(account, sas_credentials);
Ok(client.container_client(container))
}

Expand Down Expand Up @@ -484,15 +485,11 @@ mod tests {

println!(
"blob prefix {:?}",
responses
.first()
.expect("expected some blobs")
.blobs
.blob_prefix
responses.first().expect("expected some blobs").prefix
);

for response in responses {
for blob in response.blobs.blobs {
for blob in response.blobs.blobs() {
println!("{}", blob.name);
}
}
Expand Down Expand Up @@ -686,7 +683,7 @@ mod tests {
.await
.map_err(|e| anyhow!(e.to_string()))?;

let blobs: Vec<_> = pages.into_iter().flat_map(|p| p.blobs.blobs).collect();
let blobs: Vec<_> = pages.iter().flat_map(|p| p.blobs.blobs()).collect();

// test initial blob creation
assert_eq!(blobs.len(), 1, "expected exactly one blob");
Expand Down Expand Up @@ -732,9 +729,9 @@ mod tests {
.await
.map_err(|e| anyhow!(e.to_string()))?;

let blobs: Vec<_> = pages.into_iter().flat_map(|p| p.blobs.blobs).collect();
let blobs: Vec<_> = pages.iter().flat_map(|p| p.blobs.blobs()).collect();

assert_eq!(blobs.len(), 2, "expected exactly 2 blob");
assert_eq!(blobs.len(), 2, "expected exactly 2 blobs");

assert!(
blobs
Expand Down