From 935a3076c33b9c4a579966feda28d18e1d68b539 Mon Sep 17 00:00:00 2001 From: Rafael RL Date: Thu, 17 Oct 2024 11:58:24 +0200 Subject: [PATCH] Add get_server_info test case --- databroker/src/grpc/kuksa_val_v2/val.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/databroker/src/grpc/kuksa_val_v2/val.rs b/databroker/src/grpc/kuksa_val_v2/val.rs index 22de30e9..63846f8b 100644 --- a/databroker/src/grpc/kuksa_val_v2/val.rs +++ b/databroker/src/grpc/kuksa_val_v2/val.rs @@ -2714,4 +2714,27 @@ mod tests { } } } + + #[tokio::test] + async fn test_get_server_info() { + let version = "1.1.1"; + let commit_hash = "3a3c332f5427f2db7a0b8582262c9f5089036c23"; + let broker = DataBroker::new(version, commit_hash); + + let request = tonic::Request::new(proto::GetServerInfoRequest {}); + + match proto::val_server::Val::get_server_info(&broker, request) + .await + .map(|res| res.into_inner()) + { + Ok(response) => { + assert_eq!(response.name, "databroker"); + assert_eq!(response.version, version); + assert_eq!(response.commit_hash, commit_hash); + } + Err(_) => { + panic!("Should not happen") + } + } + } }