diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-01-08 15:20:24 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-01-15 08:13:40 +0100 |
| commit | 87a76504844905eaec9d3d7b705f5c3b2fa612ae (patch) | |
| tree | 15ff7f4711f3d76ec6c0d66fcf6c6d195f5aaf88 /test/test-manager/test_macro/src | |
| parent | c4157b3d961f71f64eb218c32b5c49ffb33baff1 (diff) | |
| download | mullvadvpn-87a76504844905eaec9d3d7b705f5c3b2fa612ae.tar.xz mullvadvpn-87a76504844905eaec9d3d7b705f5c3b2fa612ae.zip | |
Use type safe Mullvad protobuf client over generated dito
Re-write some code in the test framework to prefer the type safe wrapper
around the Mullvad app gRPC client instead of its auto-generated dito.
`ManagementServiceClient` is automatically generated from the protobuf
definitions found in `management_interface.proto`, and contains some
very crude types. The `MullvadProxyClient` is a type-safe wrapper around
`ManagementServiceClient` which performs conversions & validation of the
data types from the gRPC server (the daemon) to their respective
mappings in the `talpid-*` and `mullvad-*` crates. These types are more
ergonomic to work with, and since we already have the conversions in
place we should prefer those.
Diffstat (limited to 'test/test-manager/test_macro/src')
| -rw-r--r-- | test/test-manager/test_macro/src/lib.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/test-manager/test_macro/src/lib.rs b/test/test-manager/test_macro/src/lib.rs index 07f353ad7a..0f854e953b 100644 --- a/test/test-manager/test_macro/src/lib.rs +++ b/test/test-manager/test_macro/src/lib.rs @@ -11,11 +11,11 @@ use syn::{AttributeArgs, Lit, Meta, NestedMeta}; /// be used to perform arbitrary network requests, inspect the local file /// system, rebooting .. /// -/// * `mullvad_client` - a -/// [`mullvad_management_interface::ManagementServiceClient`] which provides a -/// bi-directional communication channel with the `mullvad-daemon` running -/// inside of the virtual machine. All RPC-calls as defined by -/// [`mullvad_management_interface::client`] are available on `mullvad_client`. +/// * `mullvad_client` - a [`mullvad_management_interface::MullvadProxyClient`] +/// which provides a bi-directional communication channel with the +/// `mullvad-daemon` running inside of the virtual machine. All RPC-calls as +/// defined in [`mullvad_management_interface::MullvadProxyClient`] are +/// available on `mullvad_client`. /// ///# Arguments /// @@ -47,11 +47,11 @@ use syn::{AttributeArgs, Lit, Meta, NestedMeta}; /// Remember that [`test_function`] will inject `rpc` and `mullvad_client` for /// us. /// -/// ``` +/// ```ignore /// #[test_function] /// pub async fn test_function( /// rpc: ServiceClient, -/// mut mullvad_client: mullvad_management_interface::ManagementServiceClient, +/// mut mullvad_client: mullvad_management_interface::MullvadProxyClient, /// ) -> Result<(), Error> { /// Ok(()) /// } @@ -62,11 +62,11 @@ use syn::{AttributeArgs, Lit, Meta, NestedMeta}; /// This test will run early in the test loop, won't perform any cleanup, must /// succeed and will always run. /// -/// ``` +/// ```ignore /// #[test_function(priority = -1337, cleanup = false, must_succeed = true, always_run = true)] /// pub async fn test_function( /// rpc: ServiceClient, -/// mut mullvad_client: mullvad_management_interface::ManagementServiceClient, +/// mut mullvad_client: mullvad_management_interface::MullvadProxyClient, /// ) -> Result<(), Error> { /// Ok(()) /// } @@ -274,7 +274,7 @@ fn get_test_function_parameters( let mullvad_client = match &*pat_type.ty { syn::Type::Path(syn::TypePath { path, .. }) => { match path.segments[0].ident.to_string().as_str() { - "mullvad_management_interface" | "ManagementServiceClient" => { + "mullvad_management_interface" | "MullvadProxyClient" => { let mullvad_client_version = quote! { test_rpc::mullvad_daemon::MullvadClientVersion::New }; MullvadClient::New { |
