Skip to content

time: Use simulated time in tests, rather than MockTimeSystem, except in one case testing error-message throttling#4591

Merged
mattklein123 merged 7 commits intoenvoyproxy:masterfrom
jmarantz:use-sim-time-rather-than-mock-time-mostly
Oct 3, 2018
Merged

time: Use simulated time in tests, rather than MockTimeSystem, except in one case testing error-message throttling#4591
mattklein123 merged 7 commits intoenvoyproxy:masterfrom
jmarantz:use-sim-time-rather-than-mock-time-mostly

Conversation

@jmarantz
Copy link
Contributor

@jmarantz jmarantz commented Oct 3, 2018

Description: MockTimeSystem is harder to use as you can control time with the usual mocking mechanisms, but that won't run timers, so it doesn't reflect system behavior well, potentially missing interactions. SimulatedTimeSystem is just as easy to control for the most part, unless you want to pre-program a sequence of responses to TimeSystem::monotonicTime(), which is needed in a GRPC error-message throttling test.
Risk Level: low
Testing: //test/...
Docs Changes: n/a
Release Notes: n/a

…ces.

Signed-off-by: Joshua Marantz <jmarantz@google.com>
…o stay a mock.

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@jmarantz
Copy link
Contributor Author

jmarantz commented Oct 3, 2018

@junr03 please note that this PR includes eac0c69 which I did before having merged in your #4581. ConnectionImplTest.FlushWriteAndDelayCloseTimerTriggerTest had to be excluded from the TimeSystem conversion. For some reason I couldn't get it to work and had to add some hackery to allow it to stick with a MockTimeSystem. The fact that I could only get it working with a MockTimeSystem made me suspicious of the code but I didn't find root-cause.

If you un-revert #4581 you may need to pull in the exclusion from the commit above.

As it stands it's a non-issue for this PR as you deleted the test that I was having trouble with.

…eSystem().

That was added to allow FlushWriteAndDelayCloseTimerTriggerTest to use a MockTimeSystem. If that
test is revived, we may need to bring back the virtual timeSystem() hook.

Signed-off-by: Joshua Marantz <jmarantz@google.com>
@mattklein123 mattklein123 merged commit af36171 into envoyproxy:master Oct 3, 2018
@jmarantz jmarantz deleted the use-sim-time-rather-than-mock-time-mostly branch October 3, 2018 17:21
aa-stripe pushed a commit to aa-stripe/envoy that referenced this pull request Oct 11, 2018
… in one case testing error-message throttling (envoyproxy#4591)

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Aaltan Ahmad <aa@stripe.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants