Skip to content

Commit

Permalink
Run tests using cargo-nextest (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbstp authored Feb 19, 2025
1 parent 0a55ef6 commit 2aefbdf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- master

env:
CARGO_TERM_COLOR: always

jobs:
test:
strategy:
Expand All @@ -20,6 +23,9 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: taiki-e/install-action@v2
with:
tool: nextest
- run: ./tools/tests.bash
shell: bash

Expand Down
2 changes: 2 additions & 0 deletions tests/test_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async fn test_http_url_with_https_proxy() -> Result<(), anyhow::Error> {
#[cfg(any(feature = "tls-native", feature = "__rustls"))]
#[tokio::test(flavor = "multi_thread")]
async fn test_https_url_with_http_proxy() -> Result<(), anyhow::Error> {
rustls::crypto::ring::default_provider().install_default().unwrap();
let remote_port = tools::start_hello_world_server(true).await?;
let remote_url = format!("https://localhost:{remote_port}");

Expand All @@ -76,6 +77,7 @@ async fn test_https_url_with_http_proxy() -> Result<(), anyhow::Error> {
#[cfg(any(feature = "tls-native", feature = "__rustls"))]
#[tokio::test(flavor = "multi_thread")]
async fn test_https_url_with_https_proxy() -> Result<(), anyhow::Error> {
rustls::crypto::ring::default_provider().install_default().unwrap();
let remote_port = tools::start_hello_world_server(true).await?;
let remote_url = format!("https://localhost:{remote_port}");

Expand Down
38 changes: 23 additions & 15 deletions tools/tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@ if [[ "${CI:-}" == "true" ]] ; then
echo "color = 'always'" >> .cargo/config.toml
fi

cargo test
cargo test --all-features
cargo test --no-default-features
cargo test --no-default-features --features basic-auth
cargo test --no-default-features --features charsets
cargo test --no-default-features --features compress
cargo test --no-default-features --features compress-zlib
cargo test --no-default-features --features compress-zlib-ng
cargo test --no-default-features --features form
cargo test --no-default-features --features multipart-form
cargo test --no-default-features --features json
cargo test --no-default-features --features tls-native
cargo test --no-default-features --features tls-native,tls-native-vendored
cargo test --no-default-features --features tls-rustls-webpki-roots
cargo test --no-default-features --features tls-rustls-native-roots
function testwrap {
if which cargo-nextest ; then
cargo nextest run "$@"
else
cargo test "$@"
fi
}

testwrap
testwrap --all-features
testwrap --no-default-features
testwrap --no-default-features --features basic-auth
testwrap --no-default-features --features charsets
testwrap --no-default-features --features compress
testwrap --no-default-features --features compress-zlib
testwrap --no-default-features --features compress-zlib-ng
testwrap --no-default-features --features form
testwrap --no-default-features --features multipart-form
testwrap --no-default-features --features json
testwrap --no-default-features --features tls-native
testwrap --no-default-features --features tls-native,tls-native-vendored
testwrap --no-default-features --features tls-rustls-webpki-roots
testwrap --no-default-features --features tls-rustls-native-roots

0 comments on commit 2aefbdf

Please sign in to comment.