Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests are deterministic #19

Closed
Streppel opened this issue Mar 30, 2020 · 4 comments
Closed

Tests are deterministic #19

Streppel opened this issue Mar 30, 2020 · 4 comments
Labels
accepted We plan to work this issue enhancement New feature or request

Comments

@Streppel
Copy link
Member

Streppel commented Mar 30, 2020

copy/paste from here

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

We should find a way to end this by wrapping the system clock and thus being able to mock and control it.

Further reading

@Streppel
Copy link
Member Author

We already have our interface working so now we only need to update the tests

@Streppel Streppel added the enhancement New feature or request label Mar 30, 2020
@JohnRoesler
Copy link
Contributor

The problematic time related tests are fixed using the mock time.

I think it would be interesting to see about mocking the time after func so we could run daily or hourly tests in seconds.

@Streppel
Copy link
Member Author

After that I believe we'll be done with this issue. I'll take a look into it!

@JohnRoesler JohnRoesler added the accepted We plan to work this issue label Feb 25, 2021
@JohnRoesler
Copy link
Contributor

I think this is reasonably complete now that we have the ability to set the current time with the fake time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted We plan to work this issue enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants