Add unimplemented interop test
This commit is contained in:
@@ -152,6 +152,6 @@ impl pb::server::TestService for TestService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn unimplemented_call(&self, _: Request<Empty>) -> Result<Empty> {
|
async fn unimplemented_call(&self, _: Request<Empty>) -> Result<Empty> {
|
||||||
unimplemented!()
|
Err(Status::unimplemented(""))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ trap 'echo ":; killing test server"; kill ${SERVER_PID};' EXIT
|
|||||||
|
|
||||||
./target/debug/client \
|
./target/debug/client \
|
||||||
--test_case=empty_unary,large_unary,client_streaming,server_streaming,ping_pong,\
|
--test_case=empty_unary,large_unary,client_streaming,server_streaming,ping_pong,\
|
||||||
empty_stream,status_code_and_message,special_status_message $ARG
|
empty_stream,status_code_and_message,special_status_message,unimplemented_method $ARG
|
||||||
# unimplemented_method,unimplemented_service,custom_metadata
|
# ,unimplemented_service,custom_metadata
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,15 @@ impl Status {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a new `Unimplemented` status with the associated message.
|
||||||
|
pub fn unimplemented(message: impl Into<String>) -> Status {
|
||||||
|
Status {
|
||||||
|
code: Code::Unimplemented,
|
||||||
|
message: message.into(),
|
||||||
|
details: Bytes::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: This should probably be made public eventually. Need to decide on
|
// TODO: This should probably be made public eventually. Need to decide on
|
||||||
// the exact argument type.
|
// the exact argument type.
|
||||||
#[cfg_attr(not(feature = "h2"), allow(dead_code))]
|
#[cfg_attr(not(feature = "h2"), allow(dead_code))]
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::BoxBody;
|
use crate::BoxBody;
|
||||||
use futures_core::Stream;
|
use futures_core::Stream;
|
||||||
use futures_util::{try_future::MapOk, TryFutureExt, TryStreamExt, ready};
|
use futures_util::{ready, try_future::MapOk, TryFutureExt, TryStreamExt};
|
||||||
use http::{Request, Response};
|
use http::{Request, Response};
|
||||||
use hyper::server::{conn, accept::Accept};
|
use hyper::server::{accept::Accept, conn};
|
||||||
use hyper::Body;
|
use hyper::Body;
|
||||||
use std::{net::SocketAddr, task::{Context, Poll}, pin::Pin};
|
use std::{
|
||||||
|
net::SocketAddr,
|
||||||
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
use tower_make::MakeService;
|
use tower_make::MakeService;
|
||||||
use tower_service::Service;
|
use tower_service::Service;
|
||||||
|
|
||||||
@@ -101,9 +105,7 @@ impl TcpIncoming {
|
|||||||
fn bind(addr: SocketAddr) -> Result<Self, crate::Error> {
|
fn bind(addr: SocketAddr) -> Result<Self, crate::Error> {
|
||||||
let inner = conn::AddrIncoming::bind(&addr).map_err(Box::new)?;
|
let inner = conn::AddrIncoming::bind(&addr).map_err(Box::new)?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self { inner })
|
||||||
inner,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
#[path = "openssl.rs"]
|
#[path = "openssl.rs"]
|
||||||
mod imp;
|
mod imp;
|
||||||
|
|
||||||
use tokio::net::TcpStream;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use tokio::net::TcpStream;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub(crate) struct Cert {
|
pub(crate) struct Cert {
|
||||||
|
|||||||
Reference in New Issue
Block a user