Page MenuHomePhabricator

D4582.id15051.diff
No OneTemporary

D4582.id15051.diff

diff --git a/services/commtest/tests/blob/blob_utils.rs b/services/commtest/tests/blob/blob_utils.rs
--- a/services/commtest/tests/blob/blob_utils.rs
+++ b/services/commtest/tests/blob/blob_utils.rs
@@ -5,6 +5,7 @@
pub use proto::blob_service_client::BlobServiceClient;
#[allow(dead_code)]
+#[derive(Clone)]
pub struct BlobData {
pub holder: String,
pub hash: String,
diff --git a/services/commtest/tests/blob_performance_test.rs b/services/commtest/tests/blob_performance_test.rs
--- a/services/commtest/tests/blob_performance_test.rs
+++ b/services/commtest/tests/blob_performance_test.rs
@@ -1,17 +1,25 @@
#[path = "./blob/blob_utils.rs"]
mod blob_utils;
+#[path = "./blob/put.rs"]
+mod put;
#[path = "./lib/tools.rs"]
mod tools;
use bytesize::ByteSize;
+use std::env;
use tokio::runtime::Runtime;
use tools::{obtain_number_of_threads, Error};
-use blob_utils::BlobData;
+use blob_utils::{BlobData, BlobServiceClient};
#[tokio::test]
async fn blob_performance_test() -> Result<(), Error> {
+ let port = env::var("COMM_SERVICES_PORT_BLOB")
+ .expect("port env var expected but not received");
+ let client =
+ BlobServiceClient::connect(format!("http://localhost:{}", port)).await?;
+
let number_of_threads = obtain_number_of_threads();
println!(
@@ -39,6 +47,20 @@
// PUT
rt.block_on(async {
println!("performing PUT operations");
+ let mut handlers = vec![];
+ for item in &blob_data {
+ let item_cloned = item.clone();
+ let mut client_cloned = client.clone();
+ handlers.push(tokio::spawn(async move {
+ let data_exists: bool =
+ put::run(&mut client_cloned, &item_cloned).await.unwrap();
+ assert!(!data_exists, "test data should not exist");
+ }));
+ }
+
+ for handler in handlers {
+ handler.await.unwrap();
+ }
});
// GET

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 8:44 PM (20 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2688573
Default Alt Text
D4582.id15051.diff (1 KB)

Event Timeline