Update `tower` and `tower-util` and prep for release (#378)
* Update tower and tower-util * Prepare them for release * fmt * Get tower tests working
This commit is contained in:
parent
54dd475ec0
commit
0d2a3778ad
|
@ -1,7 +1,7 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
||||||
members = [
|
members = [
|
||||||
# "tower",
|
"tower",
|
||||||
# "tower-balance",
|
# "tower-balance",
|
||||||
"tower-buffer",
|
"tower-buffer",
|
||||||
# "tower-discover",
|
# "tower-discover",
|
||||||
|
@ -19,5 +19,5 @@ members = [
|
||||||
"tower-test",
|
"tower-test",
|
||||||
"tower-timeout",
|
"tower-timeout",
|
||||||
"tower-make",
|
"tower-make",
|
||||||
# "tower-util",
|
"tower-util",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# 0.3.0 (December 4, 2019)
|
||||||
|
|
||||||
|
- Update to `tower-serivce 0.3`
|
||||||
|
- Update to `futures 0.3`
|
||||||
|
- Update to `tokio 0.2`
|
||||||
|
|
||||||
# 0.3.0-alpha.2 (September 30, 2019)
|
# 0.3.0-alpha.2 (September 30, 2019)
|
||||||
|
|
||||||
- Move to `futures-*-preview 0.3.0-alpha.19`
|
- Move to `futures-*-preview 0.3.0-alpha.19`
|
||||||
|
|
|
@ -9,7 +9,7 @@ name = "tower-util"
|
||||||
# - README.md
|
# - README.md
|
||||||
# - Update CHANGELOG.md.
|
# - Update CHANGELOG.md.
|
||||||
# - Create "v0.3.x" git tag.
|
# - Create "v0.3.x" git tag.
|
||||||
version = "0.3.0-alpha.2"
|
version = "0.3.0"
|
||||||
authors = ["Tower Maintainers <team@tower-rs.com>"]
|
authors = ["Tower Maintainers <team@tower-rs.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -23,15 +23,14 @@ categories = ["asynchronous", "network-programming"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tower-service = { version = "=0.3.0-alpha.2", path = "../tower-service" }
|
tower-service = { version = "0.3", path = "../tower-service" }
|
||||||
tower-layer = { version = "=0.3.0-alpha.2", path = "../tower-layer" }
|
tower-layer = { version = "0.3", path = "../tower-layer" }
|
||||||
pin-project = "0.4"
|
pin-project = "0.4"
|
||||||
futures-util-preview = "=0.3.0-alpha.19"
|
futures-util = "0.3"
|
||||||
futures-core-preview = "=0.3.0-alpha.19"
|
futures-core = "0.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
futures-util-preview = "=0.3.0-alpha.19"
|
tokio-test = "0.2"
|
||||||
tokio-test = "=0.2.0-alpha.6"
|
tokio = { version = "0.2", features = ["stream", "sync", "macros"] }
|
||||||
tokio = "=0.2.0-alpha.6"
|
tower = { version = "0.3", path = "../tower" }
|
||||||
tower = { version = "=0.3.0-alpha.2", path = "../tower" }
|
tower-test = { version = "0.3", path = "../tower-test" }
|
||||||
tower-test = { version = "=0.3.0-alpha.2", path = "../tower-test" }
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ use tower_service::Service;
|
||||||
/// # use std::rc::Rc;
|
/// # use std::rc::Rc;
|
||||||
/// #
|
/// #
|
||||||
/// use futures_util::future::{ready, Ready};
|
/// use futures_util::future::{ready, Ready};
|
||||||
|
/// use futures_util::StreamExt;
|
||||||
/// use tower_service::Service;
|
/// use tower_service::Service;
|
||||||
/// use tower::ServiceExt;
|
/// use tower::ServiceExt;
|
||||||
/// use tokio::prelude::*;
|
/// use tokio::prelude::*;
|
||||||
|
@ -51,9 +52,9 @@ use tower_service::Service;
|
||||||
/// let mut rsps = FirstLetter.call_all(rx);
|
/// let mut rsps = FirstLetter.call_all(rx);
|
||||||
///
|
///
|
||||||
/// // Now, let's send a few requests and then check that we get the corresponding responses.
|
/// // Now, let's send a few requests and then check that we get the corresponding responses.
|
||||||
/// reqs.try_send("one");
|
/// reqs.send("one");
|
||||||
/// reqs.try_send("two");
|
/// reqs.send("two");
|
||||||
/// reqs.try_send("three");
|
/// reqs.send("three");
|
||||||
/// drop(reqs);
|
/// drop(reqs);
|
||||||
///
|
///
|
||||||
/// // We then loop over the response Strem that we get back from call_all.
|
/// // We then loop over the response Strem that we get back from call_all.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![doc(html_root_url = "https://docs.rs/tower-util/0.3.0-alpha.2")]
|
#![doc(html_root_url = "https://docs.rs/tower-util/0.3.0")]
|
||||||
#![warn(
|
#![warn(
|
||||||
missing_debug_implementations,
|
missing_debug_implementations,
|
||||||
missing_docs,
|
missing_docs,
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl Service<&'static str> for Srv {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ordered() {
|
fn ordered() {
|
||||||
let mut mock = task::MockTask::new();
|
let mut mock = task::spawn(());
|
||||||
|
|
||||||
let admit = Rc::new(Cell::new(false));
|
let admit = Rc::new(Cell::new(false));
|
||||||
let count = Rc::new(Cell::new(0));
|
let count = Rc::new(Cell::new(0));
|
||||||
|
@ -47,44 +47,44 @@ fn ordered() {
|
||||||
count: count.clone(),
|
count: count.clone(),
|
||||||
admit: admit.clone(),
|
admit: admit.clone(),
|
||||||
};
|
};
|
||||||
let (mut tx, rx) = tokio::sync::mpsc::unbounded_channel();
|
let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
|
||||||
let ca = srv.call_all(rx);
|
let ca = srv.call_all(rx);
|
||||||
pin_mut!(ca);
|
pin_mut!(ca);
|
||||||
|
|
||||||
assert_pending!(mock.enter(|cx| ca.as_mut().poll_next(cx)));
|
assert_pending!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)));
|
||||||
tx.try_send("one").unwrap();
|
tx.send("one").unwrap();
|
||||||
mock.is_woken();
|
mock.is_woken();
|
||||||
assert_pending!(mock.enter(|cx| ca.as_mut().poll_next(cx)));
|
assert_pending!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)));
|
||||||
admit.set(true);
|
admit.set(true);
|
||||||
let v = assert_ready!(mock.enter(|cx| ca.as_mut().poll_next(cx)))
|
let v = assert_ready!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)))
|
||||||
.transpose()
|
.transpose()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(v, Some("one"));
|
assert_eq!(v, Some("one"));
|
||||||
assert_pending!(mock.enter(|cx| ca.as_mut().poll_next(cx)));
|
assert_pending!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)));
|
||||||
admit.set(true);
|
admit.set(true);
|
||||||
tx.try_send("two").unwrap();
|
tx.send("two").unwrap();
|
||||||
mock.is_woken();
|
mock.is_woken();
|
||||||
tx.try_send("three").unwrap();
|
tx.send("three").unwrap();
|
||||||
let v = assert_ready!(mock.enter(|cx| ca.as_mut().poll_next(cx)))
|
let v = assert_ready!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)))
|
||||||
.transpose()
|
.transpose()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(v, Some("two"));
|
assert_eq!(v, Some("two"));
|
||||||
assert_pending!(mock.enter(|cx| ca.as_mut().poll_next(cx)));
|
assert_pending!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)));
|
||||||
admit.set(true);
|
admit.set(true);
|
||||||
let v = assert_ready!(mock.enter(|cx| ca.as_mut().poll_next(cx)))
|
let v = assert_ready!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)))
|
||||||
.transpose()
|
.transpose()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(v, Some("three"));
|
assert_eq!(v, Some("three"));
|
||||||
admit.set(true);
|
admit.set(true);
|
||||||
assert_pending!(mock.enter(|cx| ca.as_mut().poll_next(cx)));
|
assert_pending!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)));
|
||||||
admit.set(true);
|
admit.set(true);
|
||||||
tx.try_send("four").unwrap();
|
tx.send("four").unwrap();
|
||||||
mock.is_woken();
|
mock.is_woken();
|
||||||
let v = assert_ready!(mock.enter(|cx| ca.as_mut().poll_next(cx)))
|
let v = assert_ready!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)))
|
||||||
.transpose()
|
.transpose()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(v, Some("four"));
|
assert_eq!(v, Some("four"));
|
||||||
assert_pending!(mock.enter(|cx| ca.as_mut().poll_next(cx)));
|
assert_pending!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)));
|
||||||
|
|
||||||
// need to be ready since impl doesn't know it'll get EOF
|
// need to be ready since impl doesn't know it'll get EOF
|
||||||
admit.set(true);
|
admit.set(true);
|
||||||
|
@ -92,7 +92,7 @@ fn ordered() {
|
||||||
// When we drop the request stream, CallAll should return None.
|
// When we drop the request stream, CallAll should return None.
|
||||||
drop(tx);
|
drop(tx);
|
||||||
mock.is_woken();
|
mock.is_woken();
|
||||||
let v = assert_ready!(mock.enter(|cx| ca.as_mut().poll_next(cx)))
|
let v = assert_ready!(mock.enter(|cx, _| ca.as_mut().poll_next(cx)))
|
||||||
.transpose()
|
.transpose()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(v.is_none());
|
assert!(v.is_none());
|
||||||
|
@ -108,38 +108,38 @@ fn ordered() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[tokio::test]
|
||||||
fn unordered() {
|
async fn unordered() {
|
||||||
let (mock, handle) = mock::pair::<_, &'static str>();
|
let (mock, handle) = mock::pair::<_, &'static str>();
|
||||||
pin_mut!(handle);
|
pin_mut!(handle);
|
||||||
|
|
||||||
let mut task = task::MockTask::new();
|
let mut task = task::spawn(());
|
||||||
let requests = futures_util::stream::iter(&["one", "two"]);
|
let requests = futures_util::stream::iter(&["one", "two"]);
|
||||||
|
|
||||||
let svc = mock.call_all(requests).unordered();
|
let svc = mock.call_all(requests).unordered();
|
||||||
pin_mut!(svc);
|
pin_mut!(svc);
|
||||||
|
|
||||||
assert_pending!(task.enter(|cx| svc.as_mut().poll_next(cx)));
|
assert_pending!(task.enter(|cx, _| svc.as_mut().poll_next(cx)));
|
||||||
|
|
||||||
let resp1 = assert_request_eq!(handle, &"one");
|
let resp1 = assert_request_eq!(handle, &"one");
|
||||||
let resp2 = assert_request_eq!(handle, &"two");
|
let resp2 = assert_request_eq!(handle, &"two");
|
||||||
|
|
||||||
resp2.send_response("resp 1");
|
resp2.send_response("resp 1");
|
||||||
|
|
||||||
let v = assert_ready!(task.enter(|cx| svc.as_mut().poll_next(cx)))
|
let v = assert_ready!(task.enter(|cx, _| svc.as_mut().poll_next(cx)))
|
||||||
.transpose()
|
.transpose()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(v, Some("resp 1"));
|
assert_eq!(v, Some("resp 1"));
|
||||||
assert_pending!(task.enter(|cx| svc.as_mut().poll_next(cx)));
|
assert_pending!(task.enter(|cx, _| svc.as_mut().poll_next(cx)));
|
||||||
|
|
||||||
resp1.send_response("resp 2");
|
resp1.send_response("resp 2");
|
||||||
|
|
||||||
let v = assert_ready!(task.enter(|cx| svc.as_mut().poll_next(cx)))
|
let v = assert_ready!(task.enter(|cx, _| svc.as_mut().poll_next(cx)))
|
||||||
.transpose()
|
.transpose()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(v, Some("resp 2"));
|
assert_eq!(v, Some("resp 2"));
|
||||||
|
|
||||||
let v = assert_ready!(task.enter(|cx| svc.as_mut().poll_next(cx)))
|
let v = assert_ready!(task.enter(|cx, _| svc.as_mut().poll_next(cx)))
|
||||||
.transpose()
|
.transpose()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(v.is_none());
|
assert!(v.is_none());
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
use futures_util::future::ready;
|
use futures_util::future::ready;
|
||||||
use tokio_test::block_on;
|
|
||||||
use tower_service::Service;
|
use tower_service::Service;
|
||||||
use tower_util::service_fn;
|
use tower_util::service_fn;
|
||||||
|
|
||||||
#[test]
|
#[tokio::test]
|
||||||
fn simple() {
|
async fn simple() {
|
||||||
let mut add_one = service_fn(|req| ready(Ok::<_, ()>(req + 1)));
|
let mut add_one = service_fn(|req| ready(Ok::<_, ()>(req + 1)));
|
||||||
let answer = block_on(add_one.call(1)).unwrap();
|
let answer = add_one.call(1).await.unwrap();
|
||||||
assert_eq!(answer, 2);
|
assert_eq!(answer, 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# 0.3.0 (December 4, 2019)
|
||||||
|
|
||||||
|
- Update all tower based crates to `0.3`.
|
||||||
|
- Update to `tokio 0.2`
|
||||||
|
- Update to `futures 0.3`
|
||||||
|
|
||||||
# 0.3.0-alpha.2 (September 30, 2019)
|
# 0.3.0-alpha.2 (September 30, 2019)
|
||||||
|
|
||||||
- Move to `futures-*-preview 0.3.0-alpha.19`
|
- Move to `futures-*-preview 0.3.0-alpha.19`
|
||||||
|
|
|
@ -8,7 +8,7 @@ name = "tower"
|
||||||
# - README.md
|
# - README.md
|
||||||
# - Update CHANGELOG.md.
|
# - Update CHANGELOG.md.
|
||||||
# - Create "v0.1.x" git tag.
|
# - Create "v0.1.x" git tag.
|
||||||
version = "0.3.0-alpha.2"
|
version = "0.3.0"
|
||||||
authors = ["Tower Maintainers <team@tower-rs.com>"]
|
authors = ["Tower Maintainers <team@tower-rs.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -28,20 +28,21 @@ default = ["full"]
|
||||||
full = []
|
full = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tower-buffer = { version = "=0.3.0-alpha.2", path = "../tower-buffer" }
|
tower-buffer = { version = "0.3", path = "../tower-buffer" }
|
||||||
tower-discover = { version = "=0.3.0-alpha.2", path = "../tower-discover" }
|
# tower-discover = { version = "0.3", path = "../tower-discover" }
|
||||||
tower-layer = { version = "=0.3.0-alpha.2", path = "../tower-layer" }
|
tower-layer = { version = "0.3", path = "../tower-layer" }
|
||||||
tower-limit = { version = "=0.3.0-alpha.2", path = "../tower-limit" }
|
tower-limit = { version = "0.3", path = "../tower-limit" }
|
||||||
tower-load-shed = { version = "=0.3.0-alpha.2", path = "../tower-load-shed" }
|
# tower-load-shed = { version = "0.3", path = "../tower-load-shed" }
|
||||||
tower-retry = { version = "=0.3.0-alpha.2", path = "../tower-retry" }
|
tower-retry = { version = "0.3", path = "../tower-retry" }
|
||||||
tower-service = { version = "=0.3.0-alpha.2", path = "../tower-service" }
|
tower-service = { version = "0.3", path = "../tower-service" }
|
||||||
tower-timeout = { version = "=0.3.0-alpha.2", path = "../tower-timeout" }
|
tower-timeout = { version = "0.3", path = "../tower-timeout" }
|
||||||
tower-util = { version = "=0.3.0-alpha.2", path = "../tower-util" }
|
tower-util = { version = "0.3", path = "../tower-util" }
|
||||||
futures-core-preview = "=0.3.0-alpha.19"
|
futures-core = "0.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
# [dev-dependencies]
|
||||||
env_logger = { version = "0.5.3", default-features = false }
|
# env_logger = { version = "0.5.3", default-features = false }
|
||||||
futures-util-preview = "=0.3.0-alpha.19"
|
futures-util = "0.3"
|
||||||
log = "0.4.1"
|
tokio = { version = "0.2", features = ["macros"] }
|
||||||
tokio = "=0.2.0-alpha.6"
|
# log = "0.4.1"
|
||||||
tower-test = { version = "=0.3.0-alpha.2", path = "../tower-test" }
|
# # tokio = "0.2"
|
||||||
|
tower-test = { version = "0.3", path = "../tower-test" }
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
buffer::BufferLayer,
|
buffer::BufferLayer,
|
||||||
limit::{concurrency::ConcurrencyLimitLayer, rate::RateLimitLayer},
|
limit::{concurrency::ConcurrencyLimitLayer, rate::RateLimitLayer},
|
||||||
load_shed::LoadShedLayer,
|
// load_shed::LoadShedLayer,
|
||||||
retry::RetryLayer,
|
retry::RetryLayer,
|
||||||
timeout::TimeoutLayer,
|
timeout::TimeoutLayer,
|
||||||
};
|
};
|
||||||
|
|
||||||
use tower_layer::Layer;
|
use tower_layer::{Identity, Layer, Stack};
|
||||||
use tower_util::layer::{Identity, Stack};
|
|
||||||
|
|
||||||
use std::{fmt, time::Duration};
|
use std::{fmt, time::Duration};
|
||||||
|
|
||||||
|
@ -147,9 +146,9 @@ impl<L> ServiceBuilder<L> {
|
||||||
///
|
///
|
||||||
/// `load_shed` immediately responds with an error when the next layer is
|
/// `load_shed` immediately responds with an error when the next layer is
|
||||||
/// out of capacity.
|
/// out of capacity.
|
||||||
pub fn load_shed(self) -> ServiceBuilder<Stack<LoadShedLayer, L>> {
|
// pub fn load_shed(self) -> ServiceBuilder<Stack<LoadShedLayer, L>> {
|
||||||
self.layer(LoadShedLayer::new())
|
// self.layer(LoadShedLayer::new())
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// Limit requests to at most `num` per the given duration
|
/// Limit requests to at most `num` per the given duration
|
||||||
pub fn rate_limit(self, num: u64, per: Duration) -> ServiceBuilder<Stack<RateLimitLayer, L>> {
|
pub fn rate_limit(self, num: u64, per: Duration) -> ServiceBuilder<Stack<RateLimitLayer, L>> {
|
||||||
|
|
|
@ -4,5 +4,5 @@ pub use tower_layer::Layer;
|
||||||
|
|
||||||
/// `util` exports an Identity Layer and Chain, a mechanism for chaining them.
|
/// `util` exports an Identity Layer and Chain, a mechanism for chaining them.
|
||||||
pub mod util {
|
pub mod util {
|
||||||
pub use tower_util::layer::{Identity, Stack};
|
pub use tower_layer::{Identity, Stack};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![doc(html_root_url = "https://docs.rs/tower/0.3.0-alpha.2")]
|
#![doc(html_root_url = "https://docs.rs/tower/0.3.0")]
|
||||||
// Allows refining features in the future without breaking backwards
|
// Allows refining features in the future without breaking backwards
|
||||||
// compatibility
|
// compatibility
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
|
@ -16,19 +16,21 @@
|
||||||
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use tower_buffer as buffer;
|
pub use tower_buffer as buffer;
|
||||||
#[doc(inline)]
|
// #[doc(inline)]
|
||||||
pub use tower_discover as discover;
|
// pub use tower_discover as discover;
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use tower_limit as limit;
|
pub use tower_limit as limit;
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use tower_load_shed as load_shed;
|
// pub use tower_load_shed as load_shed;
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use tower_retry as retry;
|
pub use tower_retry as retry;
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use tower_timeout as timeout;
|
pub use tower_timeout as timeout;
|
||||||
|
// pub use tower_layer as layer;
|
||||||
|
#[doc(inline)]
|
||||||
|
pub use tower_layer as layer;
|
||||||
|
|
||||||
pub mod builder;
|
pub mod builder;
|
||||||
pub mod layer;
|
|
||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
||||||
pub use crate::{builder::ServiceBuilder, util::ServiceExt};
|
pub use crate::{builder::ServiceBuilder, util::ServiceExt};
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use futures_util::{
|
use futures_util::{future::Ready, pin_mut};
|
||||||
future::{poll_fn, Ready},
|
|
||||||
pin_mut,
|
|
||||||
};
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tower::builder::ServiceBuilder;
|
use tower::builder::ServiceBuilder;
|
||||||
use tower::util::ServiceExt;
|
use tower::util::ServiceExt;
|
||||||
|
@ -9,7 +6,7 @@ use tower_buffer::BufferLayer;
|
||||||
use tower_limit::{concurrency::ConcurrencyLimitLayer, rate::RateLimitLayer};
|
use tower_limit::{concurrency::ConcurrencyLimitLayer, rate::RateLimitLayer};
|
||||||
use tower_retry::{Policy, RetryLayer};
|
use tower_retry::{Policy, RetryLayer};
|
||||||
use tower_service::*;
|
use tower_service::*;
|
||||||
use tower_test::mock;
|
use tower_test::{assert_request_eq, mock};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn builder_service() {
|
async fn builder_service() {
|
||||||
|
@ -30,11 +27,7 @@ async fn builder_service() {
|
||||||
|
|
||||||
client.ready().await.unwrap();
|
client.ready().await.unwrap();
|
||||||
let fut = client.call("hello");
|
let fut = client.call("hello");
|
||||||
let (request, rsp) = poll_fn(|cx| handle.as_mut().poll_request(cx))
|
assert_request_eq!(handle, "hello").send_response("world");
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(request, "hello");
|
|
||||||
rsp.send_response("world");
|
|
||||||
assert_eq!(fut.await.unwrap(), "world");
|
assert_eq!(fut.await.unwrap(), "world");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue