mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 18:15:48 +00:00
sc-offchain: Fix flaky http tests (#10000)
This commit is contained in:
@@ -700,7 +700,7 @@ mod tests {
|
|||||||
use super::{http, SharedClient};
|
use super::{http, SharedClient};
|
||||||
use crate::api::timestamp;
|
use crate::api::timestamp;
|
||||||
use core::convert::Infallible;
|
use core::convert::Infallible;
|
||||||
use futures::future;
|
use futures::{future, StreamExt};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use sp_core::offchain::{Duration, HttpError, HttpRequestId, HttpRequestStatus};
|
use sp_core::offchain::{Duration, HttpError, HttpRequestId, HttpRequestStatus};
|
||||||
|
|
||||||
@@ -725,7 +725,11 @@ mod tests {
|
|||||||
let server = hyper::Server::bind(&"127.0.0.1:0".parse().unwrap()).serve(
|
let server = hyper::Server::bind(&"127.0.0.1:0".parse().unwrap()).serve(
|
||||||
hyper::service::make_service_fn(|_| async move {
|
hyper::service::make_service_fn(|_| async move {
|
||||||
Ok::<_, Infallible>(hyper::service::service_fn(
|
Ok::<_, Infallible>(hyper::service::service_fn(
|
||||||
move |_req| async move {
|
move |req: hyper::Request<hyper::Body>| async move {
|
||||||
|
// Wait until the complete request was received and processed,
|
||||||
|
// otherwise the tests are flaky.
|
||||||
|
let _ = req.into_body().collect::<Vec<_>>().await;
|
||||||
|
|
||||||
Ok::<_, Infallible>(hyper::Response::new(hyper::Body::from(
|
Ok::<_, Infallible>(hyper::Response::new(hyper::Body::from(
|
||||||
"Hello World!",
|
"Hello World!",
|
||||||
)))
|
)))
|
||||||
|
|||||||
Reference in New Issue
Block a user