moka-rs / moka

A high performance concurrent caching library for Rust
Apache License 2.0
1.58k stars 72 forks source link

Flaky test `cht::segment::tests::drop_many_values` under Cargo Tarpaulin #153

Open tatsuya6502 opened 2 years ago

tatsuya6502 commented 2 years ago

Test cht::segment::tests::drop_many_values is failing occasionally when executed under Cargo Tarpaulin. Perhaps the timings of dropping invalidated cache keys are affected by Cargo Tarpaulin in a non-deterministic way (?)

https://app.circleci.com/pipelines/github/moka-rs/moka/520/workflows/ad175a12-9d63-4a20-b10d-d3dad9b78a81/jobs/506

#!/bin/bash -eo pipefail
docker run --security-opt seccomp=unconfined -v "${PWD}:/volume" \
  --env RUSTFLAGS='--cfg circleci' \
  xd009642/tarpaulin \
  cargo tarpaulin -v \
    --features 'sync, future, dash' \
    --ciserver circle-ci \
    --coveralls ${COVERALLS_TOKEN} \
    --timeout 600 \
|| true

...

failures:

---- cht::segment::tests::drop_many_values stdout ----
thread 'cht::segment::tests::drop_many_values' panicked at 'assertion failed: this_key_parent.was_dropped()', src/cht/segment.rs:1448:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: core::panicking::panic
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5
   3: moka::cht::segment::tests::drop_many_values
             at ./src/cht/segment.rs:1448:13
   4: moka::cht::segment::tests::drop_many_values::{{closure}}
             at ./src/cht/segment.rs:1364:5
   5: core::ops::function::FnOnce::call_once
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5
   6: core::ops::function::FnOnce::call_once
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

failures:
    cht::segment::tests::drop_many_values

test result: FAILED. 112 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 45.93s
tatsuya6502 commented 1 year ago

I forgot to update this issue. As a workaround, I turned off the assertion when testing with Cargo Tarpaulin: https://github.com/moka-rs/moka/commit/26dfc910f256ec52feeb3945279d5bb86dfbb052