quantum-elixir / quantum-core

:watch: Cron-like job scheduler for Elixir
https://hexdocs.pm/quantum/
Apache License 2.0
2.33k stars 149 forks source link

Problem: Nondeterministic test #347

Closed tomekowal closed 4 years ago

tomekowal commented 6 years ago
mix test test/quantum/execution_broadcaster_test.exs
...
10:26:25.205 [info]  GenStage consumer #PID<0.2975.0> is stopping after receiving cancel from producer #PID<0.277.0> with reason: :noproc

...

  1) test add loads last execution time from storage (Quantum.ExecutionBroadcasterTest)
     test/quantum/execution_broadcaster_test.exs:83
     No message matching {:received, {:execute, ^job}} after 100ms.
     The following variables were pinned:
       job = %Quantum.Job{name: #Reference<0.1053226747.2575040516.68736>, overlap: true, run_strategy: %Quantum.RunStrategy.Random{nodes: :cluster}, schedule: ~e[* * * * * * *]e, state: :active, task: nil, timezone: :utc}
     Process mailbox:
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:30]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040516.68748>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:31]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040516.68752>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:32]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040516.68757>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:33]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040516.68761>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:34]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040516.68764>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:35]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040515.72350>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:36]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040515.72354>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:37]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040515.72357>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:38]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040515.72360>}}
       {:update_last_execution_date, {Quantum.ExecutionBroadcasterTest.TestScheduler, ~N[2018-07-30 07:26:39]}, {#PID<0.3006.0>, #Reference<0.1053226747.2575040515.72363>}}
     Showing only 10 of 3599 messages.
     code: capture_log(fn ->
     stacktrace:
       test/quantum/execution_broadcaster_test.exs:118: anonymous fn/3 in Quantum.ExecutionBroadcasterTest."test add loads last execution time from storage"/1
       test/quantum/execution_broadcaster_test.exs:117: anonymous fn/0 in Quantum.ExecutionBroadcasterTest."test add loads last execution time from storage"/1
       (ex_unit) lib/ex_unit/capture_log.ex:78: ExUnit.CaptureLog.capture_log/2
       test/quantum/execution_broadcaster_test.exs:92: (test)

.....

Finished in 14.7 seconds
12 tests, 1 failure

It doesn't happen every time, but once in a couple of executions. May be a timing issue in the test itself.

maennchen commented 4 years ago

This test was replaced with a better one some time ago.