You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current implementation depends too much on using time manipulation and because of that some tests take a long time to run (testTaskAt is one example, as it depends on the system changing minute, even though I believe we could fix this by testing it differently. Another example is the recent locking implementation).
This also causes some weird bugs that happen only at certain times (I've seen cases where time.Now().Minute() + 1 was used to compare times, causing failures if you ran the test suite anytime at HH:59 -> edit to clarify, I tend to fix these when I find them :))
We should find a way to end this by wrapping the system clock and thus being able to mock and control it.
Absolutely @JohnRoesler, we will need to wrap our clock and using an interface for this is the way to go.
Currently, we use Unix() time to measure time difference instead of .After() and .Before() functions because these last two count differences up to nanoseconds, which used to cause bugs on crons that ran every second. Using Unix time, we only work with seconds. I think that if we stick to using Unix() to measure our time difference, this should be explicit somehow in the interface.
I'm really into this. It would make our tests more reliable and faster (and we currently need that)
Current implementation depends too much on using time manipulation and because of that some tests take a long time to run (testTaskAt is one example, as it depends on the system changing minute, even though I believe we could fix this by testing it differently. Another example is the recent locking implementation).
This also causes some weird bugs that happen only at certain times (I've seen cases where
time.Now().Minute() + 1
was used to compare times, causing failures if you ran the test suite anytime atHH:59
-> edit to clarify, I tend to fix these when I find them :))We should find a way to end this by wrapping the system clock and thus being able to mock and control it.
Further reading
The text was updated successfully, but these errors were encountered: