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

Stress-test HystrixObservableCollapser #643

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private static void _reset() {
// clear metrics
HystrixCommandMetrics.reset();
HystrixThreadPoolMetrics.reset();
HystrixCollapserMetrics.reset();
// clear collapsers
HystrixCollapser.reset();
// clear circuit breakers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class HystrixObservableCollapserTest {
public void init() {
// since we're going to modify properties of the same class between tests, wipe the cache each time
HystrixCollapser.reset();
Hystrix.reset();
/* we must call this to simulate a new request lifecycle running and clearing caches */
HystrixRequestContext.initializeContext();
}
Expand Down Expand Up @@ -80,6 +81,15 @@ public void testTwoRequests() throws Exception {
assertEquals(0L, metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE));
}

@Test
public void stressTestRequestCollapser() throws Exception {
for(int i = 0; i < 1000; i++) {
init();
testTwoRequests();
cleanup();
}
}

private static class TestRequestCollapser extends HystrixObservableCollapser<String, String, String, String> {

private final String value;
Expand Down