-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
WIP Fix/1986 mock time in test #2269
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oleiade
force-pushed
the
fix/1986_mock_time_in_test
branch
from
November 30, 2021 09:18
eef5c0a
to
dc67bbe
Compare
na--
requested review from
mstoykov and
codebien
and removed request for
na--
December 2, 2021 14:40
This library provides abstractions over the standard time package. It specifically provides a Clock interface wrapping the standard time functions; and MockClock offer a transparent API to mock the passage of time in our programs.
oleiade
force-pushed
the
fix/1986_mock_time_in_test
branch
from
December 3, 2021 15:22
dc67bbe
to
67fc6e0
Compare
oleiade
force-pushed
the
fix/1986_mock_time_in_test
branch
from
December 3, 2021 15:29
67fc6e0
to
dde770f
Compare
Closed. See #1986 for more details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a draft Pull Request of my attempt to mock time in test #1986 (and to hopefully get to solve #1357 in the process?). I've focused mostly on executors in
lib/executor
as they seemed a good first candidate.In its current state, the PR adds a dependency to benbjohnson/clock, and integrates its
Clock
interface in theBaseConfig
of the executors. As a default, it ensures the "standard" clock is used (the one that uses the standard library'stime
package under the hood), but it also allows us to use aclock.Mock
instance that lets us control the passage of time.While I was able to integrate the interface in the executors, and replace our usages of
time
with the addedclock
in the code. I've been struggling to get tests to pass using that technique: especially finding out where and when to make the time pass in the tests code.If you have ideas, recommendations, or want/can offer some help, this PR is here for that :)
PS: this PR's branch is based upon #2268, and you can safely ignore any commit starting with "Refactor", to focus on commits starting with "WIP" instead.