refactor(tests): use axum::serve
This commit is contained in:
parent
c2ba56ee13
commit
8f0fdfaea9
2 changed files with 14 additions and 8 deletions
|
|
@ -424,6 +424,7 @@ mod tests {
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use http::{HeaderMap, StatusCode};
|
use http::{HeaderMap, StatusCode};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
use tokio::net::TcpListener;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
// This will periodically send back internal errors to test the retry
|
// This will periodically send back internal errors to test the retry
|
||||||
|
|
@ -451,8 +452,10 @@ mod tests {
|
||||||
.route("/", post(dodgy_handler))
|
.route("/", post(dodgy_handler))
|
||||||
.with_state(state);
|
.with_state(state);
|
||||||
|
|
||||||
axum::Server::bind(&"0.0.0.0:8002".parse().unwrap())
|
axum::serve(
|
||||||
.serve(app.into_make_service())
|
TcpListener::bind("0.0.0.0:8002").await.unwrap(),
|
||||||
|
app.into_make_service(),
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,7 @@ mod tests {
|
||||||
sync::{atomic::AtomicUsize, Arc},
|
sync::{atomic::AtomicUsize, Arc},
|
||||||
time::Instant,
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
use tokio::net::TcpListener;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
// This will periodically send back internal errors to test the retry
|
// This will periodically send back internal errors to test the retry
|
||||||
|
|
@ -251,8 +252,10 @@ mod tests {
|
||||||
.route("/", post(dodgy_handler))
|
.route("/", post(dodgy_handler))
|
||||||
.with_state(state);
|
.with_state(state);
|
||||||
|
|
||||||
axum::Server::bind(&"0.0.0.0:8001".parse().unwrap())
|
axum::serve(
|
||||||
.serve(app.into_make_service())
|
TcpListener::bind("0.0.0.0:8002").await.unwrap(),
|
||||||
|
app.into_make_service(),
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue