test: bring tarpaulin coverage back up
This commit is contained in:
1 parent
fe8de2784b
commit
a6b8ce4a8f
5 files changed
+49
-14
No files matched your search
+11
-11
@@ -126,20 +126,20 @@ jobs:
|
||||
- name: Run all examples
|
||||
run: ./scripts/run_examples.sh
|
||||
|
||||
# coverage:
|
||||
# name: Code Coverage
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
coverage:
|
||||
name: Code Coverage
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# - name: Install Rust
|
||||
# uses: dtolnay/rust-toolchain@stable
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
# - name: Install cargo-tarpaulin
|
||||
# - uses: taiki-e/install-action@cargo-tarpaulin
|
||||
- name: Install cargo-tarpaulin
|
||||
- uses: taiki-e/install-action@cargo-tarpaulin
|
||||
|
||||
# - name: Generate code coverage
|
||||
# run: cargo tarpaulin --lib --all-features --out Xml --out Lcov --output-dir coverage --fail-under 80
|
||||
- name: Generate code coverage
|
||||
run: cargo tarpaulin --out Xml --out Lcov --output-dir coverage --fail-under 80
|
||||
|
||||
security:
|
||||
name: Security Audit
|
||||
|
||||
@@ -218,12 +218,12 @@ check_pass "LICENSE files present in both crates"
|
||||
section "COVERAGE CHECK"
|
||||
|
||||
echo "→ Running coverage analysis..."
|
||||
COVERAGE=$(cargo tarpaulin --lib --all-features --out Stdout 2>&1 | grep -oP '^\d+\.\d+%' | head -1 | sed 's/%//')
|
||||
COVERAGE=$(cargo tarpaulin --out Stdout 2>&1 | grep -oP '^\d+\.\d+%' | head -1 | sed 's/%//')
|
||||
if [ -z "$COVERAGE" ]; then
|
||||
check_warn "Could not determine coverage percentage"
|
||||
else
|
||||
echo " Current coverage: ${COVERAGE}%"
|
||||
if (( $(echo "$COVERAGE < 80" | bc -l) )); then
|
||||
if (($(echo "$COVERAGE < 80" | bc -l))); then
|
||||
check_warn "Coverage is ${COVERAGE}% (below 80% target)"
|
||||
else
|
||||
check_pass "Coverage is ${COVERAGE}% (meets 80% target)"
|
||||
|
||||
+17
-1
@@ -1,7 +1,10 @@
|
||||
//! Unit tests for runner module
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::hash::Hasher;
|
||||
|
||||
use crate::error::DagError;
|
||||
use crate::runner::DagRunner;
|
||||
use crate::runner::{DagRunner, PassThroughHasher};
|
||||
use crate::types::TaskHandle;
|
||||
|
||||
// Initialize tracing subscriber for tests (idempotent)
|
||||
@@ -240,3 +243,16 @@ async fn test_task_panic_in_multi_task_layer() {
|
||||
// The run should fail due to the panic
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_passthrough_hasher() {
|
||||
let mut passthrough_hashmap = HashMap::with_hasher(PassThroughHasher::default());
|
||||
passthrough_hashmap.insert(64u32, "test string");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_passthrough_hasher_only_u32() {
|
||||
let mut passthrough_hasher = PassThroughHasher::default();
|
||||
passthrough_hasher.write(&[0; 4]);
|
||||
}
|
||||
@@ -33,3 +33,9 @@ async fn test_custom_task_implementation() {
|
||||
// Can't call run again since task was consumed
|
||||
// This demonstrates the ownership model
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_empty_task_input() {
|
||||
let empty = TaskInput::empty();
|
||||
assert_eq!(empty.inputs.len(), 0);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
[test_config]
|
||||
manifest-path = "./Cargo.toml"
|
||||
skip-clean = true
|
||||
engine = "Llvm"
|
||||
# cargo-tarpaulin already reports tracing lines incorrectly when the feature is turned off,
|
||||
# and this is exacerbated when building with all-features.
|
||||
all-features = false
|
||||
run-types = ["Tests"]
|
||||
command = "Test"
|
||||
locked = true
|
||||
frozen = true
|
||||
fail-under = 80.0
|
||||
Reference in new issue
Block a user