From fc71e0cafdcd69604cc6074fe09aefc7853754c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 3 May 2024 17:14:26 +0100 Subject: [PATCH 1/3] fixed tests --- Cargo.lock | 1 + nym-node/nym-node-http-api/Cargo.toml | 1 + .../router/api/v1/gateway/client_interfaces/wireguard/mod.rs | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f22b2cb428..555d3e03bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5110,6 +5110,7 @@ dependencies = [ "fastrand 2.1.0", "headers", "hmac 0.12.1", + "hyper 1.3.1", "ipnetwork 0.16.0", "nym-crypto", "nym-http-api-common", diff --git a/nym-node/nym-node-http-api/Cargo.toml b/nym-node/nym-node-http-api/Cargo.toml index 1b9fb3043e..4efd1a2ff7 100644 --- a/nym-node/nym-node-http-api/Cargo.toml +++ b/nym-node/nym-node-http-api/Cargo.toml @@ -38,6 +38,7 @@ nym-wireguard = { path = "../../common/wireguard" } nym-wireguard-types = { path = "../../common/wireguard-types", features = ["verify"] } [dev-dependencies] +hyper.workspace = true dashmap.workspace = true serde_json.workspace = true diff --git a/nym-node/nym-node-http-api/src/router/api/v1/gateway/client_interfaces/wireguard/mod.rs b/nym-node/nym-node-http-api/src/router/api/v1/gateway/client_interfaces/wireguard/mod.rs index 775b1a69b5..d0dfe43670 100644 --- a/nym-node/nym-node-http-api/src/router/api/v1/gateway/client_interfaces/wireguard/mod.rs +++ b/nym-node/nym-node-http-api/src/router/api/v1/gateway/client_interfaces/wireguard/mod.rs @@ -104,6 +104,7 @@ mod test { use crate::api::v1::gateway::client_interfaces::wireguard::{ routes, WireguardAppState, WireguardAppStateInner, }; + use axum::body::to_bytes; use axum::body::Body; use axum::http::Request; use axum::http::StatusCode; @@ -203,7 +204,7 @@ mod test { nonce, gateway_data, wg_port: 8080, - } = serde_json::from_slice(&hyper::body::to_bytes(response.into_body()).await.unwrap()) + } = serde_json::from_slice(&to_bytes(response.into_body(), usize::MAX).await.unwrap()) .unwrap() else { panic!("invalid response") @@ -257,7 +258,7 @@ mod test { assert_eq!(response.status(), StatusCode::OK); let clients: Vec = - serde_json::from_slice(&hyper::body::to_bytes(response.into_body()).await.unwrap()) + serde_json::from_slice(&to_bytes(response.into_body(), usize::MAX).await.unwrap()) .unwrap(); assert!(!clients.is_empty()); From b342eb870e6977a1212cf25e3ea799fc0fe7a065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Tue, 7 May 2024 15:01:38 +0100 Subject: [PATCH 2/3] removed explicit drops --- gateway/src/http/mod.rs | 2 -- mixnode/src/node/http/mod.rs | 2 -- 2 files changed, 4 deletions(-) diff --git a/gateway/src/http/mod.rs b/gateway/src/http/mod.rs index 5b691ccf0b..63e8068fdb 100644 --- a/gateway/src/http/mod.rs +++ b/gateway/src/http/mod.rs @@ -303,8 +303,6 @@ impl<'a> HttpApiBuilder<'a> { Ok(server) => server.with_task_client(task_client), Err(err) => { error!("failed to create http server: {err}"); - // this will cause global shutdown - drop(task_client); return; } }; diff --git a/mixnode/src/node/http/mod.rs b/mixnode/src/node/http/mod.rs index 4707a44f71..76b13a236a 100644 --- a/mixnode/src/node/http/mod.rs +++ b/mixnode/src/node/http/mod.rs @@ -110,8 +110,6 @@ impl<'a> HttpApiBuilder<'a> { Ok(server) => server.with_task_client(task_client), Err(err) => { error!("failed to create http server: {err}"); - // this will cause global shutdown - drop(task_client); return; } }; From 890d0f74407177c721eb583c3f63787f09737a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Mon, 13 May 2024 14:18:33 +0100 Subject: [PATCH 3/3] fixed incorrect dependency path for 'axum-extra' --- nym-node/nym-node-http-api/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nym-node/nym-node-http-api/Cargo.toml b/nym-node/nym-node-http-api/Cargo.toml index 4efd1a2ff7..ab15236224 100644 --- a/nym-node/nym-node-http-api/Cargo.toml +++ b/nym-node/nym-node-http-api/Cargo.toml @@ -8,7 +8,7 @@ license.workspace = true [dependencies] axum.workspace = true -axum-extra = { axum.workspace = true, features = ["typed-header"] } +axum-extra = { workspace = true, features = ["typed-header"] } headers.workspace = true # useful for `#[axum_macros::debug_handler]`