tests cleanup; cargo clippy fixes, minor doc updates (#177)

* Tests cleanup; cargo clippy fixes, minor doc updates
* updated label checker workflow
This commit is contained in:
Henk-Jan Lebbink
2025-07-11 11:08:22 +02:00
committed by GitHub
parent e0a77fcb1a
commit e244229490
26 changed files with 326 additions and 216 deletions

View File

@@ -14,6 +14,7 @@ chrono = "0.4.41"
reqwest = "0.12.20"
http = "1.3.1"
futures = "0.3.31"
uuid = { version = "1.17.0", features = ["v4"] }
[lib]
name = "minio_common"

View File

@@ -15,16 +15,24 @@
use http::{Response as HttpResponse, StatusCode};
use minio::s3::error::Error;
use rand::distributions::{Alphanumeric, DistString};
use rand::distributions::Standard;
use rand::{Rng, thread_rng};
use uuid::Uuid;
pub fn rand_bucket_name() -> String {
Alphanumeric
.sample_string(&mut rand::thread_rng(), 8)
.to_lowercase()
format!("test-bucket-{}", Uuid::new_v4())
}
pub fn rand_object_name() -> String {
Alphanumeric.sample_string(&mut rand::thread_rng(), 20)
format!("test-object-{}", Uuid::new_v4())
}
pub fn rand_object_name_utf8(len: usize) -> String {
let rng = thread_rng();
rng.sample_iter::<char, _>(Standard)
.filter(|c| !c.is_control())
.take(len)
.collect()
}
pub async fn get_bytes_from_response(v: Result<reqwest::Response, Error>) -> bytes::Bytes {