Page MenuHomePhabricator

D5171.diff
No OneTemporary

D5171.diff

diff --git a/services/commtest/tests/backup/add_attachments.rs b/services/commtest/tests/backup/add_attachments.rs
--- a/services/commtest/tests/backup/add_attachments.rs
+++ b/services/commtest/tests/backup/add_attachments.rs
@@ -1,14 +1,8 @@
-#[path = "./backup_utils.rs"]
-mod backup_utils;
-#[path = "../lib/tools.rs"]
-mod tools;
-
-use crate::backup_utils::{proto::AddAttachmentsRequest, BackupServiceClient};
-
-use tonic::Request;
-
-use crate::backup_utils::BackupData;
+use crate::backup::backup_utils::{
+ proto::AddAttachmentsRequest, BackupData, BackupServiceClient,
+};
use crate::tools::{Error, ATTACHMENT_DELIMITER};
+use tonic::Request;
// log_index = None means that we add attachments to the backup
// log_index = Some(x) means that we add attachments to a specific log
diff --git a/services/commtest/tests/backup/backup_utils.rs b/services/commtest/tests/backup/backup_utils.rs
--- a/services/commtest/tests/backup/backup_utils.rs
+++ b/services/commtest/tests/backup/backup_utils.rs
@@ -1,12 +1,10 @@
pub mod proto {
tonic::include_proto!("backup");
}
-
pub use proto::backup_service_client::BackupServiceClient;
use std::collections::HashMap;
// stands for both, backup and log items
-#[allow(dead_code)]
#[derive(Clone)]
pub struct Item {
pub id: String,
@@ -14,7 +12,6 @@
pub attachments_holders: Vec<String>,
}
-#[allow(dead_code)]
impl Item {
pub fn new(
id: String,
@@ -29,7 +26,6 @@
}
}
-#[allow(dead_code)]
#[derive(Clone)]
pub struct BackupData {
pub user_id: String,
@@ -38,7 +34,6 @@
pub log_items: Vec<Item>,
}
-#[allow(dead_code)]
pub fn compare_backups(backup_data: &BackupData, result: &BackupData) {
// check backup size
let expected: usize = backup_data.backup_item.chunks_sizes.iter().sum();
diff --git a/services/commtest/tests/backup/create_new_backup.rs b/services/commtest/tests/backup/create_new_backup.rs
--- a/services/commtest/tests/backup/create_new_backup.rs
+++ b/services/commtest/tests/backup/create_new_backup.rs
@@ -1,16 +1,9 @@
-#[path = "./backup_utils.rs"]
-mod backup_utils;
-#[path = "../lib/tools.rs"]
-mod tools;
-
-use crate::backup_utils::{
+use crate::backup::backup_utils::{
proto::create_new_backup_request::Data::*, proto::CreateNewBackupRequest,
BackupData, BackupServiceClient,
};
-
-use tonic::Request;
-
use crate::tools::{generate_stable_nbytes, DataHasher, Error};
+use tonic::Request;
pub async fn run(
client: &mut BackupServiceClient<tonic::transport::Channel>,
diff --git a/services/commtest/tests/backup/mod.rs b/services/commtest/tests/backup/mod.rs
new file mode 100644
--- /dev/null
+++ b/services/commtest/tests/backup/mod.rs
@@ -0,0 +1,5 @@
+pub mod add_attachments;
+pub mod backup_utils;
+pub mod create_new_backup;
+pub mod pull_backup;
+pub mod send_log;
diff --git a/services/commtest/tests/backup/pull_backup.rs b/services/commtest/tests/backup/pull_backup.rs
--- a/services/commtest/tests/backup/pull_backup.rs
+++ b/services/commtest/tests/backup/pull_backup.rs
@@ -1,19 +1,11 @@
-#[path = "./backup_utils.rs"]
-mod backup_utils;
-#[path = "../lib/tools.rs"]
-mod tools;
-
-use std::io::{Error as IOError, ErrorKind};
-use tonic::Request;
-
-use crate::backup_utils::{
+use crate::backup::backup_utils::{
proto::pull_backup_response::Data, proto::pull_backup_response::Data::*,
proto::pull_backup_response::Id, proto::pull_backup_response::Id::*,
- proto::PullBackupRequest, BackupServiceClient,
+ proto::PullBackupRequest, BackupData, BackupServiceClient, Item,
};
-
-use crate::backup_utils::{BackupData, Item};
use crate::tools::{Error, ATTACHMENT_DELIMITER};
+use std::io::{Error as IOError, ErrorKind};
+use tonic::Request;
#[derive(PartialEq, Debug)]
enum State {
diff --git a/services/commtest/tests/backup/send_log.rs b/services/commtest/tests/backup/send_log.rs
--- a/services/commtest/tests/backup/send_log.rs
+++ b/services/commtest/tests/backup/send_log.rs
@@ -1,16 +1,9 @@
-#[path = "./backup_utils.rs"]
-mod backup_utils;
-#[path = "../lib/tools.rs"]
-mod tools;
-
-use crate::backup_utils::{
- proto::send_log_request::Data::*, proto::SendLogRequest, BackupServiceClient,
+use crate::backup::backup_utils::{
+ proto::{send_log_request::Data::*, SendLogRequest},
+ BackupData, BackupServiceClient,
};
-
-use tonic::Request;
-
-use crate::backup_utils::BackupData;
use crate::tools::{generate_stable_nbytes, DataHasher, Error};
+use tonic::Request;
pub async fn run(
client: &mut BackupServiceClient<tonic::transport::Channel>,
diff --git a/services/commtest/tests/backup_integration_test.rs b/services/commtest/tests/backup_integration_test.rs
--- a/services/commtest/tests/backup_integration_test.rs
+++ b/services/commtest/tests/backup_integration_test.rs
@@ -1,24 +1,15 @@
-#[path = "./backup/add_attachments.rs"]
-mod add_attachments;
-#[path = "./backup/backup_utils.rs"]
-mod backup_utils;
-#[path = "./backup/create_new_backup.rs"]
-mod create_new_backup;
-#[path = "./backup/pull_backup.rs"]
-mod pull_backup;
-#[path = "./backup/send_log.rs"]
-mod send_log;
-#[path = "./lib/tools.rs"]
+mod backup;
mod tools;
-use backup_utils::{BackupData, Item};
+use backup::{
+ add_attachments,
+ backup_utils::{self, BackupData, BackupServiceClient, Item},
+ create_new_backup, pull_backup, send_log,
+};
use bytesize::ByteSize;
use std::collections::HashMap;
-use tools::Error;
-
use std::env;
-
-use backup_utils::BackupServiceClient;
+use tools::Error;
#[tokio::test]
async fn backup_integration_test() -> Result<(), Error> {
diff --git a/services/commtest/tests/backup_performance_test.rs b/services/commtest/tests/backup_performance_test.rs
--- a/services/commtest/tests/backup_performance_test.rs
+++ b/services/commtest/tests/backup_performance_test.rs
@@ -1,25 +1,17 @@
-#[path = "./backup/add_attachments.rs"]
-mod add_attachments;
-#[path = "./backup/backup_utils.rs"]
-mod backup_utils;
-#[path = "./backup/create_new_backup.rs"]
-mod create_new_backup;
-#[path = "./backup/pull_backup.rs"]
-mod pull_backup;
-#[path = "./backup/send_log.rs"]
-mod send_log;
-#[path = "./lib/tools.rs"]
+mod backup;
mod tools;
+use backup::{
+ add_attachments,
+ backup_utils::{self, BackupData, BackupServiceClient, Item},
+ create_new_backup, pull_backup, send_log,
+};
use bytesize::ByteSize;
use std::env;
use std::sync::mpsc::channel;
-
use tokio::runtime::Runtime;
use tools::{obtain_number_of_threads, Error};
-use backup_utils::{BackupData, BackupServiceClient, Item};
-
#[tokio::test]
async fn backup_performance_test() -> Result<(), Error> {
let port = env::var("COMM_SERVICES_PORT_BACKUP")
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
@@ -4,7 +4,6 @@
pub use proto::blob_service_client::BlobServiceClient;
-#[allow(dead_code)]
#[derive(Clone)]
pub struct BlobData {
pub holder: String,
diff --git a/services/commtest/tests/blob/get.rs b/services/commtest/tests/blob/get.rs
--- a/services/commtest/tests/blob/get.rs
+++ b/services/commtest/tests/blob/get.rs
@@ -1,12 +1,6 @@
-#[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::blob::blob_utils::{proto::GetRequest, BlobData, BlobServiceClient};
use crate::tools::Error;
+use tonic::Request;
pub async fn run(
client: &mut BlobServiceClient<tonic::transport::Channel>,
diff --git a/services/commtest/tests/blob/mod.rs b/services/commtest/tests/blob/mod.rs
new file mode 100644
--- /dev/null
+++ b/services/commtest/tests/blob/mod.rs
@@ -0,0 +1,4 @@
+pub mod blob_utils;
+pub mod get;
+pub mod put;
+pub mod remove;
diff --git a/services/commtest/tests/blob/put.rs b/services/commtest/tests/blob/put.rs
--- a/services/commtest/tests/blob/put.rs
+++ b/services/commtest/tests/blob/put.rs
@@ -1,15 +1,8 @@
-#[path = "./blob_utils.rs"]
-mod blob_utils;
-#[path = "../lib/tools.rs"]
-mod tools;
-
-use crate::blob_utils::{
+use crate::blob::blob_utils::{
proto::put_request::Data::*, proto::PutRequest, BlobData, BlobServiceClient,
};
-
-use tonic::Request;
-
use crate::tools::{generate_stable_nbytes, Error};
+use tonic::Request;
pub async fn run(
client: &mut BlobServiceClient<tonic::transport::Channel>,
diff --git a/services/commtest/tests/blob/remove.rs b/services/commtest/tests/blob/remove.rs
--- a/services/commtest/tests/blob/remove.rs
+++ b/services/commtest/tests/blob/remove.rs
@@ -1,12 +1,8 @@
-#[path = "./blob_utils.rs"]
-mod blob_utils;
-#[path = "../lib/tools.rs"]
-mod tools;
-
-use tonic::Request;
-
-use crate::blob_utils::{proto::RemoveRequest, BlobData, BlobServiceClient};
+use crate::blob::blob_utils::{
+ proto::RemoveRequest, BlobData, BlobServiceClient,
+};
use crate::tools::Error;
+use tonic::Request;
pub async fn run(
client: &mut BlobServiceClient<tonic::transport::Channel>,
diff --git a/services/commtest/tests/blob_integration_test.rs b/services/commtest/tests/blob_integration_test.rs
--- a/services/commtest/tests/blob_integration_test.rs
+++ b/services/commtest/tests/blob_integration_test.rs
@@ -1,18 +1,12 @@
-#[path = "./blob/blob_utils.rs"]
-mod blob_utils;
-#[path = "./blob/get.rs"]
-mod get;
-#[path = "./blob/put.rs"]
-mod put;
-#[path = "./blob/remove.rs"]
-mod remove;
-#[path = "./lib/tools.rs"]
+mod blob;
mod tools;
+use blob::{
+ blob_utils::{BlobData, BlobServiceClient},
+ get, put, remove,
+};
use bytesize::ByteSize;
use std::env;
-
-use blob_utils::{BlobData, BlobServiceClient};
use tools::Error;
#[tokio::test]
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,22 +1,15 @@
-#[path = "./blob/blob_utils.rs"]
-mod blob_utils;
-#[path = "./blob/get.rs"]
-mod get;
-#[path = "./blob/put.rs"]
-mod put;
-#[path = "./blob/remove.rs"]
-mod remove;
-#[path = "./lib/tools.rs"]
+mod blob;
mod tools;
+use blob::{
+ blob_utils::{BlobData, BlobServiceClient},
+ get, put, remove,
+};
use bytesize::ByteSize;
use std::env;
-
use tokio::runtime::Runtime;
use tools::{obtain_number_of_threads, Error};
-use blob_utils::{BlobData, BlobServiceClient};
-
#[tokio::test]
async fn blob_performance_test() -> Result<(), Error> {
let port = env::var("COMM_SERVICES_PORT_BLOB")
diff --git a/services/commtest/tests/lib/tools.rs b/services/commtest/tests/tools/mod.rs
rename from services/commtest/tests/lib/tools.rs
rename to services/commtest/tests/tools/mod.rs
--- a/services/commtest/tests/lib/tools.rs
+++ b/services/commtest/tests/tools/mod.rs
@@ -1,12 +1,12 @@
+#![allow(dead_code)]
+
use bytesize::ByteSize;
+use hex::ToHex;
use lazy_static::lazy_static;
use num_cpus;
-use std::env;
-
-use hex::ToHex;
use sha2::{Digest, Sha512};
+use std::env;
-#[allow(dead_code)]
pub fn generate_stable_nbytes(
number_of_bytes: usize,
predefined_byte_value: Option<u8>,
@@ -36,10 +36,8 @@
(ByteSize::mib(4).as_u64() as usize) - GRPC_METADATA_SIZE_BYTES;
}
-#[allow(dead_code)]
pub const ATTACHMENT_DELIMITER: &str = ";";
-#[allow(dead_code)]
pub fn obtain_number_of_threads() -> usize {
let number_of_threads_str: String =
env::var("COMM_NUMBER_OF_THREADS").unwrap();
@@ -49,12 +47,10 @@
return number_of_threads_str.parse::<usize>().unwrap();
}
-#[allow(dead_code)]
pub struct DataHasher {
hasher: Sha512,
}
-#[allow(dead_code)]
impl DataHasher {
pub fn new() -> DataHasher {
return DataHasher {
diff --git a/services/commtest/tests/tunnelbroker_integration_test.rs b/services/commtest/tests/tunnelbroker_integration_test.rs
--- a/services/commtest/tests/tunnelbroker_integration_test.rs
+++ b/services/commtest/tests/tunnelbroker_integration_test.rs
@@ -1,4 +1,3 @@
-#[path = "./lib/tools.rs"]
mod tools;
#[tokio::test]

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 11:34 AM (17 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2699836
Default Alt Text
D5171.diff (11 KB)

Event Timeline