Skip to content

Commit

Permalink
Fix the web build
Browse files Browse the repository at this point in the history
  • Loading branch information
akoshelev committed Nov 30, 2024
1 parent a0fe132 commit 0762bb1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ipa-core/src/net/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ pub(crate) mod tests {
ff::{FieldType, Fp31},
helpers::{
make_owned_handler, query::QueryType::TestMultiply, BytesStream, HelperIdentity,
HelperResponse, RequestHandler, RoleAssignment, Transport, MESSAGE_PAYLOAD_SIZE_BYTES,
HelperResponse, RequestHandler, RoleAssignment, MESSAGE_PAYLOAD_SIZE_BYTES,
},
net::test::TestServer,
protocol::step::TestExecutionStep,
Expand Down Expand Up @@ -759,7 +759,7 @@ pub(crate) mod tests {
resp_ok(resp).await.unwrap();

let mut stream = transport
.receive(HelperIdentity::ONE, (QueryId, expected_step.clone()))
.receive(HelperIdentity::ONE, &(QueryId, expected_step.clone()))
.into_bytes_stream();

assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/net/server/handlers/query/status_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ mod tests {
#[tokio::test]
async fn other_query_error() {
let handler = make_owned_handler(
move |addr: Addr<ShardIndex>, _data: BodyStream| async move {
move |_addr: Addr<ShardIndex>, _data: BodyStream| async move {
Err(ApiError::QueryStatus(QueryStatusError::NoSuchQuery(
QueryId,
)))
Expand Down
7 changes: 6 additions & 1 deletion ipa-core/src/net/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use std::{
ops::Index,
};

#[cfg(all(test, unit_test))]
use http_body_util::BodyExt;
#[cfg(all(test, unit_test))]
use hyper::StatusCode;
use once_cell::sync::Lazy;
use rustls_pki_types::CertificateDer;
Expand Down Expand Up @@ -231,7 +233,7 @@ impl TestApp {
&self.mpc_network_config,
&identities.helper,
);
let (transport, server) = MpcHttpTransport::new(
let (transport, server) = crate::net::MpcHttpTransport::new(
IpaRuntime::current(),
sid.helper_identity,
self.mpc_server.config,
Expand Down Expand Up @@ -509,6 +511,7 @@ impl TestServer<Helper> {
TestServerBuilder::default()
}

#[cfg(all(test, unit_test))]
pub async fn oneshot_success(
req: hyper::Request<axum::body::Body>,
handler: Arc<dyn RequestHandler<HelperIdentity>>,
Expand All @@ -526,6 +529,7 @@ impl TestServer<Helper> {
}

impl TestServer<Shard> {
#[cfg(all(test, unit_test))]
pub async fn oneshot(
req: hyper::Request<axum::body::Body>,
handler: Arc<dyn RequestHandler<ShardIndex>>,
Expand All @@ -537,6 +541,7 @@ impl TestServer<Shard> {
test_server.server.handle_req(req).await
}

#[cfg(all(test, unit_test))]
pub async fn oneshot_success(
req: hyper::Request<axum::body::Body>,
handler: Arc<dyn RequestHandler<ShardIndex>>,
Expand Down
10 changes: 5 additions & 5 deletions ipa-core/src/net/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,18 +442,18 @@ mod tests {
.build()
.await;

transport.inner_transport.record_streams.add_stream(
transport.record_streams.add_stream(
(QueryId, HelperIdentity::ONE, Gate::default()),
BodyStream::empty(),
);
assert_eq!(1, transport.inner_transport.record_streams.len());
assert_eq!(1, transport.record_streams.len());

Transport::clone_ref(&transport)
Arc::clone(&transport)
.dispatch((RouteId::KillQuery, QueryId), BodyStream::empty())
.await
.unwrap();

assert!(transport.inner_transport.record_streams.is_empty());
assert!(transport.record_streams.is_empty());
}

#[tokio::test]
Expand All @@ -471,7 +471,7 @@ mod tests {

// Request step data reception (normally called by protocol)
let mut stream = transport
.receive(HelperIdentity::TWO, (QueryId, STEP.clone()))
.receive(HelperIdentity::TWO, &(QueryId, STEP.clone()))
.into_bytes_stream();

// make sure it is not ready as it hasn't received any data yet.
Expand Down

0 comments on commit 0762bb1

Please sign in to comment.