bugfix: fix axum 0.8 migration in mix-stress testing endpoints (#6824)
This commit is contained in:
committed by
GitHub
parent
9782bae54b
commit
343a48c297
@@ -15,7 +15,7 @@ use tower_http::compression::CompressionLayer;
|
||||
pub(crate) fn routes() -> Router<AppState> {
|
||||
Router::new()
|
||||
.route("/described", get(get_described_nodes))
|
||||
.route("/annotation/:node_id", get(get_node_annotation))
|
||||
.route("/annotation/{node_id}", get(get_node_annotation))
|
||||
.layer(CompressionLayer::new())
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ async fn known_network_monitor(
|
||||
fn stress_testing_routes() -> Router<AppState> {
|
||||
Router::new()
|
||||
.route("/batch-submit", post(batch_submit_stress_testing_results))
|
||||
.route("/known-monitors/:identity_key", get(known_network_monitor))
|
||||
.route("/known-monitors/{identity_key}", get(known_network_monitor))
|
||||
}
|
||||
|
||||
/// Build the `/v3/nym-nodes` subtree hosting the v3 network-monitor endpoints.
|
||||
|
||||
@@ -167,3 +167,17 @@ impl ApiHttpServer {
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// Axum 0.8 panics inside `.route(...)` when given the legacy `:param`
|
||||
/// path syntax. That panic never fires at `cargo check` time, so a regression
|
||||
/// only surfaces when nym-api boots. This test exercises the whole route tree
|
||||
/// to catch such regressions in CI.
|
||||
#[test]
|
||||
fn default_router_builds_without_panic() {
|
||||
let _ = RouterBuilder::with_default_routes(false, None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ pub mod routes {
|
||||
pub mod results {
|
||||
use super::*;
|
||||
|
||||
pub const TESTRUN_BY_ID: &str = "/testrun/:id";
|
||||
pub const NYM_NODE_BY_NODE_ID: &str = "/nym-node/:node_id";
|
||||
pub const NYM_NODE_TESTRUNS: &str = "/nym-node/:node_id/testruns";
|
||||
pub const TESTRUN_BY_ID: &str = "/testrun/{id}";
|
||||
pub const NYM_NODE_BY_NODE_ID: &str = "/nym-node/{node_id}";
|
||||
pub const NYM_NODE_TESTRUNS: &str = "/nym-node/{node_id}/testruns";
|
||||
pub const TESTRUNS_IN_PROGRESS: &str = "/testruns-in-progress";
|
||||
pub const TESTRUNS: &str = "/testruns";
|
||||
pub const NYM_NODES: &str = "/nym-nodes";
|
||||
|
||||
@@ -27,3 +27,20 @@ pub(crate) fn routes(
|
||||
.route_layer(metrics_and_results_auth),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::sync::Arc;
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
/// Axum 0.8 panics inside `.route(...)` when given the legacy `:param`
|
||||
/// path syntax. That panic never fires at `cargo check` time, so a regression
|
||||
/// only surfaces when the orchestrator boots. This test exercises the whole
|
||||
/// v1 route tree to catch such regressions in CI.
|
||||
#[test]
|
||||
fn v1_router_builds_without_panic() {
|
||||
let dummy_auth = || AuthLayer::new(Arc::new(Zeroizing::new(String::new())));
|
||||
let _ = routes(dummy_auth(), dummy_auth());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user