Skip to content

Commit 30ea97a

Browse files
author
Matt Jacobs
committed
Larger bucket sizes for CumulativeCommandEventCounterStreamTest
1 parent 8a5c48c commit 30ea97a

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

hystrix-core/src/test/java/com/netflix/hystrix/metric/consumer/CumulativeCommandEventCounterStreamTest.java

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ public void tearDown() {
7878
@Test
7979
public void testEmptyStreamProducesZeros() {
8080
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-A");
81-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
81+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
8282
stream.startCachingStreamValuesIfUnstarted();
8383

8484
final CountDownLatch latch = new CountDownLatch(1);
85-
stream.observe().take(10).subscribe(getSubscriber(latch));
85+
stream.observe().take(5).subscribe(getSubscriber(latch));
8686

8787
//no writes
8888

@@ -98,11 +98,11 @@ public void testEmptyStreamProducesZeros() {
9898
@Test
9999
public void testSingleSuccess() {
100100
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-B");
101-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
101+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
102102
stream.startCachingStreamValuesIfUnstarted();
103103

104104
final CountDownLatch latch = new CountDownLatch(1);
105-
stream.observe().take(10).subscribe(getSubscriber(latch));
105+
stream.observe().take(5).subscribe(getSubscriber(latch));
106106

107107
Command cmd = Command.from(groupKey, key, HystrixEventType.SUCCESS, 20);
108108

@@ -122,11 +122,11 @@ public void testSingleSuccess() {
122122
@Test
123123
public void testSingleFailure() {
124124
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-C");
125-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
125+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
126126
stream.startCachingStreamValuesIfUnstarted();
127127

128128
final CountDownLatch latch = new CountDownLatch(1);
129-
stream.observe().take(10).subscribe(getSubscriber(latch));
129+
stream.observe().take(5).subscribe(getSubscriber(latch));
130130

131131
Command cmd = Command.from(groupKey, key, HystrixEventType.FAILURE, 20);
132132

@@ -147,11 +147,11 @@ public void testSingleFailure() {
147147
@Test
148148
public void testSingleTimeout() {
149149
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-D");
150-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
150+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
151151
stream.startCachingStreamValuesIfUnstarted();
152152

153153
final CountDownLatch latch = new CountDownLatch(1);
154-
stream.observe().take(10).subscribe(getSubscriber(latch));
154+
stream.observe().take(5).subscribe(getSubscriber(latch));
155155

156156
Command cmd = Command.from(groupKey, key, HystrixEventType.TIMEOUT);
157157

@@ -172,11 +172,11 @@ public void testSingleTimeout() {
172172
@Test
173173
public void testSingleBadRequest() {
174174
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-E");
175-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
175+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
176176
stream.startCachingStreamValuesIfUnstarted();
177177

178178
final CountDownLatch latch = new CountDownLatch(1);
179-
stream.observe().take(10).subscribe(getSubscriber(latch));
179+
stream.observe().take(5).subscribe(getSubscriber(latch));
180180

181181
Command cmd = Command.from(groupKey, key, HystrixEventType.BAD_REQUEST);
182182

@@ -197,11 +197,11 @@ public void testSingleBadRequest() {
197197
@Test
198198
public void testRequestFromCache() {
199199
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-F");
200-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
200+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
201201
stream.startCachingStreamValuesIfUnstarted();
202202

203203
final CountDownLatch latch = new CountDownLatch(1);
204-
stream.observe().take(10).subscribe(getSubscriber(latch));
204+
stream.observe().take(5).subscribe(getSubscriber(latch));
205205

206206
Command cmd1 = Command.from(groupKey, key, HystrixEventType.SUCCESS, 20);
207207
Command cmd2 = Command.from(groupKey, key, HystrixEventType.RESPONSE_FROM_CACHE);
@@ -228,11 +228,11 @@ public void testRequestFromCache() {
228228
@Test
229229
public void testShortCircuited() {
230230
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-G");
231-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
231+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
232232
stream.startCachingStreamValuesIfUnstarted();
233233

234234
final CountDownLatch latch = new CountDownLatch(1);
235-
stream.observe().take(10).subscribe(getSubscriber(latch));
235+
stream.observe().take(5).subscribe(getSubscriber(latch));
236236

237237
//3 failures in a row will trip circuit. let bucket roll once then submit 2 requests.
238238
//should see 3 FAILUREs and 2 SHORT_CIRCUITs and then 5 FALLBACK_SUCCESSes
@@ -249,7 +249,7 @@ public void testShortCircuited() {
249249
failure3.observe();
250250

251251
try {
252-
Thread.sleep(100);
252+
Thread.sleep(500);
253253
} catch (InterruptedException ie) {
254254
fail(ie.getMessage());
255255
}
@@ -277,11 +277,11 @@ public void testShortCircuited() {
277277
@Test
278278
public void testSemaphoreRejected() {
279279
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-H");
280-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
280+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
281281
stream.startCachingStreamValuesIfUnstarted();
282282

283283
final CountDownLatch latch = new CountDownLatch(1);
284-
stream.observe().take(10).subscribe(getSubscriber(latch));
284+
stream.observe().take(5).subscribe(getSubscriber(latch));
285285

286286
//10 commands will saturate semaphore when called from different threads.
287287
//submit 2 more requests and they should be SEMAPHORE_REJECTED
@@ -290,7 +290,7 @@ public void testSemaphoreRejected() {
290290
List<Command> saturators = new ArrayList<Command>();
291291

292292
for (int i = 0; i < 10; i++) {
293-
saturators.add(Command.from(groupKey, key, HystrixEventType.SUCCESS, 200, HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE));
293+
saturators.add(Command.from(groupKey, key, HystrixEventType.SUCCESS, 500, HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE));
294294
}
295295

296296
Command rejected1 = Command.from(groupKey, key, HystrixEventType.SUCCESS, 0, HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE);
@@ -334,11 +334,11 @@ public void run() {
334334
@Test
335335
public void testThreadPoolRejected() {
336336
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-I");
337-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
337+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
338338
stream.startCachingStreamValuesIfUnstarted();
339339

340340
final CountDownLatch latch = new CountDownLatch(1);
341-
stream.observe().take(10).subscribe(getSubscriber(latch));
341+
stream.observe().take(5).subscribe(getSubscriber(latch));
342342

343343
//10 commands will saturate threadpools when called concurrently.
344344
//submit 2 more requests and they should be THREADPOOL_REJECTED
@@ -347,7 +347,7 @@ public void testThreadPoolRejected() {
347347
List<Command> saturators = new ArrayList<Command>();
348348

349349
for (int i = 0; i < 10; i++) {
350-
saturators.add(Command.from(groupKey, key, HystrixEventType.SUCCESS, 200));
350+
saturators.add(Command.from(groupKey, key, HystrixEventType.SUCCESS, 500));
351351
}
352352

353353
Command rejected1 = Command.from(groupKey, key, HystrixEventType.SUCCESS, 0);
@@ -386,11 +386,11 @@ public void testThreadPoolRejected() {
386386
@Test
387387
public void testFallbackFailure() {
388388
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-J");
389-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
389+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
390390
stream.startCachingStreamValuesIfUnstarted();
391391

392392
final CountDownLatch latch = new CountDownLatch(1);
393-
stream.observe().take(10).subscribe(getSubscriber(latch));
393+
stream.observe().take(5).subscribe(getSubscriber(latch));
394394

395395
Command cmd = Command.from(groupKey, key, HystrixEventType.FAILURE, 20, HystrixEventType.FALLBACK_FAILURE);
396396

@@ -412,11 +412,11 @@ public void testFallbackFailure() {
412412
@Test
413413
public void testFallbackMissing() {
414414
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-K");
415-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
415+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
416416
stream.startCachingStreamValuesIfUnstarted();
417417

418418
final CountDownLatch latch = new CountDownLatch(1);
419-
stream.observe().take(10).subscribe(getSubscriber(latch));
419+
stream.observe().take(5).subscribe(getSubscriber(latch));
420420

421421
Command cmd = Command.from(groupKey, key, HystrixEventType.FAILURE, 20, HystrixEventType.FALLBACK_MISSING);
422422

@@ -438,11 +438,11 @@ public void testFallbackMissing() {
438438
@Test
439439
public void testFallbackRejection() {
440440
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-L");
441-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
441+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
442442
stream.startCachingStreamValuesIfUnstarted();
443443

444444
final CountDownLatch latch = new CountDownLatch(1);
445-
stream.observe().take(10).subscribe(getSubscriber(latch));
445+
stream.observe().take(5).subscribe(getSubscriber(latch));
446446

447447
//fallback semaphore size is 5. So let 5 commands saturate that semaphore, then
448448
//let 2 more commands go to fallback. they should get rejected by the fallback-semaphore
@@ -485,11 +485,11 @@ public void testFallbackRejection() {
485485
@Test
486486
public void testCancelled() {
487487
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-CumulativeCounter-M");
488-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
488+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
489489
stream.startCachingStreamValuesIfUnstarted();
490490

491491
final CountDownLatch latch = new CountDownLatch(1);
492-
stream.observe().take(10).subscribe(getSubscriber(latch));
492+
stream.observe().take(5).subscribe(getSubscriber(latch));
493493

494494
Command toCancel = Command.from(groupKey, key, HystrixEventType.SUCCESS, 500);
495495

@@ -535,11 +535,11 @@ public void onNext(Integer i) {
535535
@Test
536536
public void testCollapsed() {
537537
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("BatchCommand");
538-
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 100);
538+
stream = CumulativeCommandEventCounterStream.getInstance(key, 10, 500);
539539
stream.startCachingStreamValuesIfUnstarted();
540540

541541
final CountDownLatch latch = new CountDownLatch(1);
542-
stream.observe().take(10).subscribe(getSubscriber(latch));
542+
stream.observe().take(5).subscribe(getSubscriber(latch));
543543

544544
for (int i = 0; i < 3; i++) {
545545
CommandStreamTest.Collapser.from(i).observe();

0 commit comments

Comments
 (0)