Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3502765
D4167.id13252.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4167.id13252.diff
View Options
diff --git a/services/commtest/build.rs b/services/commtest/build.rs
--- a/services/commtest/build.rs
+++ b/services/commtest/build.rs
@@ -4,10 +4,11 @@
let target_service = env::var("COMM_TEST_TARGET")
.map_err(|err| -> String { format!("invalid test target: {}", err) })?;
// use this when using docker
- // tonic_build::compile_protos(format!("protos/{}.proto", target_service))?;
- tonic_build::compile_protos(format!(
- "../../native/cpp/CommonCpp/grpc/protos/{}.proto",
- target_service
- ))?;
+ tonic_build::compile_protos(format!("protos/{}.proto", target_service))?;
+ // use this for building on the host machine
+ // tonic_build::compile_protos(format!(
+ // "../../native/cpp/CommonCpp/grpc/protos/{}.proto",
+ // target_service
+ // ))?;
Ok(())
}
diff --git a/services/commtest/src/main.rs b/services/commtest/src/main.rs
new file mode 100644
--- /dev/null
+++ b/services/commtest/src/main.rs
@@ -0,0 +1,33 @@
+use std::env;
+
+pub mod proto {
+ tonic::include_proto!("backup");
+}
+
+pub mod backup_utils;
+mod create_new_backup;
+mod send_log;
+
+use backup_utils::BackupServiceClient;
+
+#[tokio::main]
+async fn main() -> Result<(), Box<dyn std::error::Error>> {
+ let target_service = env::var("COMM_TEST_TARGET")?;
+ println!("testing service {}", target_service);
+
+ let mut client = BackupServiceClient::connect("http://[::0]:50052").await?;
+
+ let user_id: String = "user0000".to_string();
+ let device_id: String = "device0000".to_string();
+
+ let backup_id = create_new_backup::run(&mut client, &user_id, &device_id)
+ .await
+ .map_err(|err| -> String { format!("create new backup error: {}", err) })?;
+ println!("backup id in main: {}", backup_id);
+ send_log::run(&mut client, &user_id, &backup_id)
+ .await
+ .map_err(|err| -> String { format!("send log: {}", err) })?;
+
+ println!("tested");
+ Ok(())
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 5:06 AM (8 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2685988
Default Alt Text
D4167.id13252.diff (1 KB)
Attached To
Mode
D4167: [DRAFT] [services] Tests - Add main
Attached
Detach File
Event Timeline
Log In to Comment