Skip to content

Commit 2deaa92

Browse files
committed
Merge pull request #1055 from mattrjacobs/deflake-pool-filling-tests
Made HystrixCommandTest.testRejectedThreadWithFallback more deterministic
2 parents 1fb2407 + 8e50980 commit 2deaa92

File tree

4 files changed

+204
-313
lines changed

4 files changed

+204
-313
lines changed

hystrix-core/src/test/java/com/netflix/hystrix/AbstractTestHystrixCommand.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@
1919

2020
public interface AbstractTestHystrixCommand<R> extends HystrixObservable<R>, InspectableBuilder {
2121

22-
public static enum ExecutionResult {
22+
enum ExecutionResult {
2323
SUCCESS, FAILURE, ASYNC_FAILURE, HYSTRIX_FAILURE, ASYNC_HYSTRIX_FAILURE, RECOVERABLE_ERROR, ASYNC_RECOVERABLE_ERROR, UNRECOVERABLE_ERROR, ASYNC_UNRECOVERABLE_ERROR, BAD_REQUEST, ASYNC_BAD_REQUEST, MULTIPLE_EMITS_THEN_SUCCESS, MULTIPLE_EMITS_THEN_FAILURE, NO_EMITS_THEN_SUCCESS
2424
}
2525

26-
public static enum FallbackResult {
26+
enum FallbackResult {
2727
UNIMPLEMENTED, SUCCESS, FAILURE, ASYNC_FAILURE, MULTIPLE_EMITS_THEN_SUCCESS, MULTIPLE_EMITS_THEN_FAILURE, NO_EMITS_THEN_SUCCESS
2828
}
2929

30-
public static enum CacheEnabled {
30+
enum CacheEnabled {
3131
YES, NO
3232
}
3333

34-
static HystrixPropertiesStrategy TEST_PROPERTIES_FACTORY = new TestPropertiesFactory();
34+
HystrixPropertiesStrategy TEST_PROPERTIES_FACTORY = new TestPropertiesFactory();
3535

36-
static class TestPropertiesFactory extends HystrixPropertiesStrategy {
36+
class TestPropertiesFactory extends HystrixPropertiesStrategy {
3737

3838
@Override
3939
public HystrixCommandProperties getCommandProperties(HystrixCommandKey commandKey, HystrixCommandProperties.Setter builder) {
@@ -72,5 +72,4 @@ public String getCollapserPropertiesCacheKey(HystrixCollapserKey collapserKey, c
7272
}
7373

7474
}
75-
7675
}

hystrix-core/src/test/java/com/netflix/hystrix/CommonHystrixCommandTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* Place to share code and tests between {@link HystrixCommandTest} and {@link HystrixObservableCommandTest}.
4747
* @param <C>
4848
*/
49-
public abstract class CommonHystrixCommandTests<C extends AbstractTestHystrixCommand<?>> {
49+
public abstract class CommonHystrixCommandTests<C extends AbstractTestHystrixCommand<Integer>> {
5050

5151
/**
5252
* Run the command in multiple modes and check that the hook assertions hold in each and that the command succeeds
@@ -116,9 +116,9 @@ protected void assertNonBlockingObserve(C command, Action1<C> assertion, boolean
116116
System.out.println("Running command.observe(), awaiting terminal state of Observable, then running assertions...");
117117
final CountDownLatch latch = new CountDownLatch(1);
118118

119-
Observable<?> o = command.observe();
119+
Observable<Integer> o = command.observe();
120120

121-
o.subscribe(new Subscriber<Object>() {
121+
o.subscribe(new Subscriber<Integer>() {
122122
@Override
123123
public void onCompleted() {
124124
latch.countDown();
@@ -130,7 +130,7 @@ public void onError(Throwable e) {
130130
}
131131

132132
@Override
133-
public void onNext(Object t) {
133+
public void onNext(Integer i) {
134134
//do nothing
135135
}
136136
});

0 commit comments

Comments
 (0)