From 2d6bbd2cd8335e5fb5a3addf0ecaed3a62fa73ed Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 18 Oct 2019 13:35:07 -0700 Subject: [PATCH] chore(ci): re-enable CI running on beta --- .travis.yml | 22 +++++++++++----------- Cargo.toml | 2 +- tests/server.rs | 18 +++++++++++------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4972b8bd..ef167ece 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,27 @@ language: rust -#sudo: true # Required for functional IPv6 (forces VM instead of Docker). +sudo: true # Required for functional IPv6 (forces VM instead of Docker). dist: trusty matrix: fast_finish: true include: - rust: nightly - env: FEATURES="--no-default-features --features runtime,nightly" - #- rust: beta - # env: FEATURES="--no-default-features --features runtime,__internal_happy_eyeballs_tests" + env: FEATURES="--no-default-features --features runtime,unstable-stream,nightly" + - rust: beta + env: FEATURES="--no-default-features --features runtime,unstable-stream,__internal_happy_eyeballs_tests" #- rust: stable - # env: FEATURES="--no-default-features --features runtime,__internal_happy_eyeballs_tests" - - rust: nightly #stable + # env: FEATURES="--no-default-features --features runtime,unstable-stream,__internal_happy_eyeballs_tests" + - rust: beta #stable env: FEATURES="--no-default-features" # Minimum Supported Rust Version - #- rust: 1.36.0 + #- rust: 1.39.0 # env: FEATURES="--no-default-features --features runtime" BUILD_ONLY="1" -#before_script: +before_script: # Add an IPv6 config - see the corresponding Travis issue # https://github.com/travis-ci/travis-ci/issues/83 - #- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then - # sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; - # fi + - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then + sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; + fi script: - 'if [ "$BUILD_ONLY" != "1" ]; then cargo test $FEATURES -- --test-threads=1; fi' diff --git a/Cargo.toml b/Cargo.toml index 8afa3eed..61c4414f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -200,4 +200,4 @@ required-features = ["runtime", "unstable-stream"] [[test]] name = "server" path = "tests/server.rs" -required-features = ["runtime", "unstable-stream"] +required-features = ["runtime"] diff --git a/tests/server.rs b/tests/server.rs index cf3bd200..cbda4f22 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -1,6 +1,5 @@ -#![feature(async_closure)] #![deny(warnings)] -#![warn(rust_2018_idioms)] +#![deny(rust_2018_idioms)] use std::net::{TcpStream, Shutdown, SocketAddr}; use std::io::{self, Read, Write}; @@ -19,7 +18,7 @@ use futures_core::future::BoxFuture; use futures_util::future::{self, Either, FutureExt}; use futures_util::stream::StreamExt; use futures_util::try_future::{self, TryFutureExt}; -use futures_util::try_stream::TryStreamExt; +//use futures_util::try_stream::TryStreamExt; use http::header::{HeaderName, HeaderValue}; use tokio_net::driver::Handle; use tokio_net::tcp::{TcpListener, TcpStream as TkTcpStream}; @@ -1469,6 +1468,7 @@ fn max_buf_size() { rt.block_on(fut).expect_err("should TooLarge error"); } +#[cfg(feature = "unstable-stream")] #[test] fn streaming_body() { let _ = pretty_env_logger::try_init(); @@ -1584,6 +1584,7 @@ fn http2_service_error_sends_reset_reason() { assert_eq!(h2_err.reason(), Some(h2::Reason::INADEQUATE_SECURITY)); } +#[cfg(feature = "unstable-stream")] #[test] fn http2_body_user_error_sends_reset_reason() { use std::error::Error; @@ -1601,15 +1602,18 @@ fn http2_body_user_error_sends_reset_reason() { let mut rt = Runtime::new().expect("runtime new"); - let err = rt.block_on({ + let err: hyper::Error = rt.block_on(async move { let client = Client::builder() .http2_only(true) .build_http::(); let uri = addr_str.parse().expect("server addr should parse"); - client - .get(uri) - .and_then(|res| res.into_body().try_concat()) + let mut res = client.get(uri).await?; + + while let Some(chunk) = res.body_mut().next().await { + chunk?; + } + Ok(()) }).unwrap_err(); let h2_err = err