Closed davejlong closed 5 years ago
Looking at the failing test, it's around testing time and is breaking because we are making assumptions about how long code takes to run. It's going to work locally on our PCs dedicated to running these tests, but will fail on shared systems like those that Travis CI uses. Is there a better way for us to test time without needed to assume how long code will take to run? Perhaps if we could look at system time instead of user time...
@davejlong There's a better way to test this. Instead of inspecting the process mailbox directly, we should wait for the job to be called n
times (for a given n
) and then then assert_in_delta
that the system time difference is n
times the interval. What do you think?
The issue with checking the time is that Erlang's :timer.tc
is gives user
time instead of system time so we'll probably always see different
environments, especially ones with really long wait times like Travis, give
pretty widely varying results.
On Tue, Jun 13, 2017, 5:05 PM Dimitrios Zorbas notifications@github.com wrote:
@davejlong https://github.com/davejlong There's a better way to test this. Instead of inspecting the process mailbox directly, we should wait for the job to be called n times (for a given n) and then then assert_in_delta that the system time difference is n times the interval. What do you think?
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/kittoframework/kitto/pull/113#issuecomment-308248434, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKs1YOCyUF_rAi5NpyJUvHnXWazODGJks5sDvmogaJpZM4N2ORQ .
The test is simply to say that a job gets run more than once. The new test asserts this by letting the job run for 1 seconds and ensures that within that second the job has run more than once.