Hi, thanks for the library, it's fun and easy to use!
I suspect I hit a bug with mockito 0.11.0. I have a small test suite of 3 tests and 50% of the time it fails. It may be a race condition, however it's just a wild guess since I'm very new to mockito and I don't know how exactly it works.
I am using the following code: https://github.com/kyrylo/airbrake-rust/tree/reboot
You can clone the repo (make sure to checkout the reboot
branch, commit sha is a6514530305c537a029af838a86cdef72fbeb948
) and run tests yourself. Here's a sample output:
% cargo test -- --nocapture
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Running target/debug/deps/airbrake-9afc2687bc83f1a7
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Running target/debug/deps/airbrake-ac572b687ba1c60e
running 3 tests
thread 'it_notifies_airbrake' panicked at 'assertion failed: `(left == right)`
left: `1`,
right: `2`:
Expected 1 request(s) to:
POST /api/v3/projects/113743/notices
content-type: application/json
...but received 2
', /Users/kyrylo/.cargo/registry/src/github.com-1ecc6299db9ec823/mockito-0.11.0/src/lib.rs:677:44
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'it_attaches_a_backtrace' panicked at 'assertion failed: `(left == right)`
left: `1`,
right: `0`:
Expected 1 request(s) to:
POST /api/v3/projects/113743/notices
"backtrace":\[\{"line":\d+,"file":".+","function":".+".*\}\]
...but received 0
', /Users/kyrylo/.cargo/registry/src/github.com-1ecc6299db9ec823/mockito-0.11.0/src/lib.rs:677:44
test it_notifies_airbrake ... FAILED
test it_attaches_a_backtrace ... FAILED
thread 'it_attaches_params' panicked at 'assertion failed: `(left == right)`
left: `1`,
right: `0`:
Expected 1 request(s) to:
POST /api/v3/projects/113743/notices
"params":\{"banana":\{"String":"tasty"\},"mango":\{"Int32":42\}\}
...but received 0
', /Users/kyrylo/.cargo/registry/src/github.com-1ecc6299db9ec823/mockito-0.11.0/src/lib.rs:677:44
test it_attaches_params ... FAILED
failures:
failures:
it_attaches_a_backtrace
it_attaches_params
it_notifies_airbrake
test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out
error: test failed, to rerun pass '--test airbrake'
As you can see one of the tests outputs ...but received 2
, however I make only one HTTP request there. The call is in the same thread and it's synchronous (at least I can state that my library's code doesn't do anything clever in this department).
It's worth mentioning that if I comment the last test, then the other 2 tests pass consistently. Perhaps, the test is flawed? I can't see how it could be the case, but if it is, my apologies for the false report.
I would appreciate some assistance here. Thanks!
work in progress