survemobility / gaffer

Prioritised, parallel job scheduler with concurrent exclusion, job merging, recurring jobs and load limiting for lower priorities.
Apache License 2.0
46 stars 7 forks source link

Racy tests #3

Open workingjubilee opened 2 months ago

workingjubilee commented 2 months ago

Your tests appear to be pretty racy, unfortunately:

[INFO] [stdout] running 6 tests
[INFO] [stdout] test integration_2_thread_limited ... ok
[INFO] [stdout] test integration_1_thread_recurrance ... ok
[INFO] [stdout] test integration_2_threads_poll_preferred ... ok
[INFO] [stdout] test integration_2_threads_block ... ok
[INFO] [stdout] test integration_1_thread_blocked ... FAILED
[INFO] [stdout] test panic_in_job ... ok
[INFO] [stdout] 
[INFO] [stdout] failures:
[INFO] [stdout] 
[INFO] [stdout] ---- integration_1_thread_blocked stdout ----
[INFO] [stdout] Completed job WaitJob(10µs took 546.84µs, 3, None, 'b', ..)
[INFO] [stdout] Completed job WaitJob(400µs took 1.32904ms, 1, None, 'a', ..)
[INFO] [stdout] Completed job WaitJob(10µs took 1.13645ms, 1, None, 'c', ..)
[INFO] [stdout] Completed job WaitJob(10µs took 1.2256ms, 1, None, 'd', ..)
[INFO] [stdout] Completed job WaitJob(10µs took 1.31299ms, 1, None, 'e', ..)
[INFO] [stdout] thread 'integration_1_thread_blocked' panicked at tests/integration.rs:57:5:
[INFO] [stdout] assertion `left == right` failed
[INFO] [stdout]   left: "abcde"
[INFO] [stdout]  right: "bacde"
test source::test::queued_resets_recurring ... FAILED

failures:

---- source::test::queued_resets_recurring stdout ----
thread 'source::test::queued_resets_recurring' panicked at src/source.rs:320:9:
assertion `left == right` failed
  left: [Tester(3), Tester(2), Tester(1)]
 right: [Tester(2)]

failures:
    source::test::queued_resets_recurring

test result: FAILED. 36 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

It's not immediately clear to me what's wrong but you should, in particular, be aware that thread::sleep promises only a minimum, not a maximum, of a sleep time.

workingjubilee commented 2 months ago

And to be clear:

Limitations

some of the tests are very dependent on timing and will fail if run slowly

My computer is very not-slow.