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

Scheduler that manually advances time #24243

Merged
merged 11 commits into from
Jan 31, 2018

Conversation

raboof
Copy link
Member

@raboof raboof commented Jan 4, 2018

#24150

First version for early review. More tests, docs and Java examples still TBD.

@raboof raboof force-pushed the typed-tests-manually-advance-scheduler branch from bbedcb2 to d28c4c8 Compare January 4, 2018 15:50
@akka-ci akka-ci added the validating PR is currently being validated by Jenkins label Jan 4, 2018

class ManualTimerSpec extends TestKit() with ManualTime with WordSpecLike {
//#manual-scheduling-simple
"A timer" must {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice

@akka-ci akka-ci added tested PR that was successfully built and tested by Jenkins and removed validating PR is currently being validated by Jenkins labels Jan 4, 2018
@akka-ci
Copy link

akka-ci commented Jan 4, 2018

Test PASSed.

@raboof raboof changed the title Scheduler that manually advances time (# Scheduler that manually advances time Jan 5, 2018
* For testing: scheduler that does not look at the clock, but must be progressed manually by calling `timePasses`.
*
* This is not entirely realistic: jobs will be executed on the test thread instead of using the `ExecutionContext`, but does
* allow for faster and less timing-sensitive specs..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we still have them run on whatever execution context they want through futures, but block time Passes on the futures completion?

Copy link
Member Author

@raboof raboof Jan 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not really help, as the resulting behavior would still be different from what would happen when the jobs were executed in 'real time' parallel. I'll make the wording somewhat less scary.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels Jan 5, 2018
@akka-ci
Copy link

akka-ci commented Jan 5, 2018

Test FAILed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR is currently being validated by Jenkins labels Jan 5, 2018
@akka-ci
Copy link

akka-ci commented Jan 5, 2018

Test FAILed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) labels Jan 5, 2018
* We will not add a dilation factor to this amount, since the scheduler API also does not apply dilation.
* If you want the amount of time passed to be dilated, apply the dilation before passing the delay to
* this method.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This will execute all outstanding jobs on the calling thread before returning" or such?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍. (It will also execute any jobs that are scheduled to be executed within the specified period by those outstanding jobs, but that might be a subtlety that doesn't really belong in the scaladoc here)

@akka-ci akka-ci added tested PR that was successfully built and tested by Jenkins and removed validating PR is currently being validated by Jenkins labels Jan 5, 2018
@akka-ci
Copy link

akka-ci commented Jan 5, 2018

Test PASSed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels Jan 5, 2018
@akka-ci
Copy link

akka-ci commented Jan 5, 2018

Test PASSed.

@raboof raboof force-pushed the typed-tests-manually-advance-scheduler branch from b261dd9 to 55c0faf Compare January 23, 2018 15:53
@akka-ci akka-ci added tested PR that was successfully built and tested by Jenkins and removed validating PR is currently being validated by Jenkins labels Jan 23, 2018
@akka-ci
Copy link

akka-ci commented Jan 23, 2018

Test PASSed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels Jan 23, 2018
@akka-ci
Copy link

akka-ci commented Jan 23, 2018

Test PASSed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels Jan 24, 2018
@akka-ci
Copy link

akka-ci commented Jan 24, 2018

Test PASSed.

Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@patriknw patriknw merged commit fe5a425 into master Jan 31, 2018
@patriknw patriknw deleted the typed-tests-manually-advance-scheduler branch January 31, 2018 13:48
manonthegithub pushed a commit to manonthegithub/akka that referenced this pull request Jan 31, 2018
* Don't apply dilation to scheduler parameter
* Clarify ExecutionContext usage
* Clarify comment on timePasses
* Make ExplicitlyTriggeredScheduler internals private
* List currently scheduled tasks in one log message
* Execute immediately if (initialDelay <= Duration.Zero)
* Don't reschedule if scheduled task fails
* Be more efficient about logging
* Widen `timePasses` delay for now
akka#24243 (comment) for some
discussion on what to do instead
* Remove mechanism for mixing in config from a test trait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:typed tested PR that was successfully built and tested by Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants