Skip to content

Commit

Permalink
Fix tests runner (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 authored Sep 5, 2024
1 parent a1d260c commit 3edb54f
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 42 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ jobs:
run: cargo llvm-cov clean --workspace

- name: Code coverage (glommio)
run: cargo +nightly llvm-cov --no-report --all --no-default-features --features="glommio,cookie,url,compress,openssl,rustls,ws,brotli"
continue-on-error: true
run: cargo llvm-cov --no-report --all --no-default-features --features="ntex/glommio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" -- --skip test_unhandled_data

- name: Code coverage (compio)
run: cargo +nightly llvm-cov --no-report --all --no-default-features --features="compio,cookie,url,compress,openssl,rustls,ws,brotli"
- name: Code coverage (tokio)
run: cargo llvm-cov --no-report --all --no-default-features --features="ntex/tokio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"

- name: Code coverage
run: RUST_LOG=trace cargo +nightly llvm-cov --no-report --all --doctests --no-default-features --features="tokio,cookie,url,compress,openssl,rustls,ws,brotli"
- name: Code coverage (compio)
run: cargo llvm-cov --no-report --all --no-default-features --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"

- name: Generate coverage report
run: cargo +nightly llvm-cov report --lcov --output-path lcov.info --ignore-filename-regex="ntex-tokio|ntex-glommio|ntex-async-std|ntex-compio"
run: cargo llvm-cov report --lcov --output-path lcov.info --ignore-filename-regex="ntex-compio|ntex-tokio|ntex-glommio|ntex-async-std"

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,21 @@ jobs:
path: ~/.cargo/git
key: ${{ matrix.version }}-x86_64-unknown-linux-gnu-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Run tests
- name: Run tests (tokio)
timeout-minutes: 40
run: cargo test --all --all-features --no-fail-fast -- --nocapture
run: |
cargo test --all --no-fail-fast --no-default-features --features="ntex/tokio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"
- name: Run compio tests
- name: Run tests (compio)
timeout-minutes: 40
run: |
cd ntex
cargo test --no-default-features --no-fail-fast --features="compio,cookie,url,compress,openssl,rustls,ws,brotli"
cargo test --all --no-default-features --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"
- name: Run async-std tests
- name: Run tests (async-std)
timeout-minutes: 40
continue-on-error: true
run: |
cd ntex
cargo test --no-default-features --no-fail-fast --features="async-std,cookie,url,compress,openssl,rustls,ws,brotli"
cargo test --all --no-default-features --features="ntex/async-std,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"
- name: Install cargo-cache
continue-on-error: true
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,17 @@ jobs:
path: ~/.cargo/git
key: ${{ matrix.version }}-aarch64-apple-darwin-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Run tests
run: cargo test --all --all-features --no-fail-fast -- --nocapture
- name: Run tests (tokio)
run: cargo test --all --no-default-features --no-fail-fast --features="ntex/tokio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"

- name: Run compio tests
- name: Run tests (compio)
timeout-minutes: 40
run: |
cd ntex
cargo test --no-default-features --no-fail-fast --features="compio,cookie,url,compress,openssl,rustls,ws,brotli"
run: cargo test --all --no-default-features --no-fail-fast --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"

- name: Install cargo-cache
continue-on-error: true
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
run: cargo install cargo-cache --no-default-features --features ci-autoclean

- name: Clear the cargo caches
continue-on-error: true
run: |
cargo-cache
run: cargo-cache
11 changes: 4 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,10 @@ jobs:
Get-ChildItem C:\vcpkg\installed\x64-windows\bin
Get-ChildItem C:\vcpkg\installed\x64-windows\lib
- name: Run tests
- name: Run tests (tokio)
run: |
cargo test --lib --all-features --no-fail-fast -- --nocapture --skip test_timer
cargo test --all --lib --no-default-features --no-fail-fast --features="ntex/tokio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" -- --skip test_timer
- name: Run compio tests
timeout-minutes: 40
continue-on-error: true
- name: Run tests (compio)
run: |
cd ntex
cargo test --no-default-features --no-fail-fast --features="compio,cookie,url,compress,openssl,rustls,ws,brotli"
cargo test --all --lib --no-default-features --no-fail-fast --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" -- --skip test_timer
2 changes: 1 addition & 1 deletion ntex-bytes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ simdutf8 = { version = "0.1.4", optional = true }
[dev-dependencies]
serde_test = "1"
serde_json = "1"
ntex = { version = "2", features = ["tokio"] }
ntex = "2"
ntex-bytes = { path = ".", features = ["mpool"] }
3 changes: 1 addition & 2 deletions ntex-io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ log = "0.4"
pin-project-lite = "0.2"

[dev-dependencies]
ntex = "2"
rand = "0.8"
env_logger = "0.11"

ntex = { version = "2", features = ["tokio"] }
4 changes: 3 additions & 1 deletion ntex-io/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,14 +605,14 @@ where

#[cfg(test)]
mod tests {
use rand::Rng;
use std::sync::{atomic::AtomicBool, atomic::Ordering::Relaxed, Arc, Mutex};
use std::{cell::RefCell, io};

use ntex_bytes::{Bytes, BytesMut, PoolId, PoolRef};
use ntex_codec::BytesCodec;
use ntex_service::ServiceCtx;
use ntex_util::{time::sleep, time::Millis};
use rand::Rng;

use super::*;
use crate::{testing::IoTest, Flags, Io, IoRef, IoStream};
Expand Down Expand Up @@ -823,6 +823,7 @@ mod tests {
assert_eq!(buf, Bytes::from_static(b"GET /test HTTP/1\r\n\r\n"));

// write side must be closed, dispatcher waiting for read side to close
sleep(Millis(250)).await;
assert!(client.is_closed());

// close read side
Expand Down Expand Up @@ -875,6 +876,7 @@ mod tests {
assert_eq!(buf, Bytes::from_static(b"GET /test HTTP/1\r\n\r\n"));

// write side must be closed, dispatcher waiting for read side to close
sleep(Millis(250)).await;
assert!(client.is_closed());

// close read side
Expand Down
4 changes: 2 additions & 2 deletions ntex-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ syn = { version = "^1", features = ["full", "parsing"] }
proc-macro2 = "^1"

[dev-dependencies]
ntex = { version = "2", features = ["tokio"] }
ntex = "2"
futures = "0.3"
env_logger = "0.11"
env_logger = "0.11"
2 changes: 1 addition & 1 deletion ntex-net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ log = "0.4"
thiserror = "1"

[dev-dependencies]
ntex = "2"
env_logger = "0.11"
ntex = { version = "2", features = ["tokio"] }
1 change: 1 addition & 0 deletions ntex-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub unsafe fn spawn_cbs<FBefore, FEnter, FExit, FAfter>(
});
}

#[allow(dead_code)]
#[cfg(feature = "tokio")]
mod tokio {
use std::future::{poll_fn, Future};
Expand Down
2 changes: 1 addition & 1 deletion ntex-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ socket2 = "0.5"
oneshot = { version = "0.1", default-features = false, features = ["async"] }

[dev-dependencies]
ntex = { version = "2", features = ["tokio"] }
ntex = "2"
ntex-macros = "0.1.3"

[target.'cfg(target_family = "unix")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion ntex-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ path = "src/lib.rs"
slab = "0.4"

[dev-dependencies]
ntex = { version = "2", features = ["tokio"] }
ntex = "2"
ntex-util = "2"
2 changes: 1 addition & 1 deletion ntex-tls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tls_openssl = { version = "0.10", package = "openssl", optional = true }
tls_rust = { version = "0.23", package = "rustls", optional = true }

[dev-dependencies]
ntex = { version = "2", features = ["openssl", "rustls", "tokio"] }
ntex = { version = "2", features = ["openssl", "rustls"] }
env_logger = "0.11"
rustls-pemfile = "2"
webpki-roots = "0.26"
2 changes: 1 addition & 1 deletion ntex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ edition = "2021"
rust-version = "1.75"

[package.metadata.docs.rs]
features = ["tokio", "openssl", "rustls", "compress", "cookie", "ws", "brotli"]
features = ["compio", "tokio", "openssl", "rustls", "compress", "cookie", "ws", "brotli"]

[lib]
name = "ntex"
Expand Down

0 comments on commit 3edb54f

Please sign in to comment.