Skip to content

Commit

Permalink
Removing bad tests of thread-interruption on HystrixObservableCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Jacobs committed Jun 13, 2016
1 parent 3583415 commit 30c94ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ private FutureCompleterWithConfigurableInterrupt(Future<?> f, Func0<Boolean> sho

@Override
public void unsubscribe() {
System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " Unsubscribe happening, value of thunk : " + shouldInterruptThread.call());
if (shouldInterruptThread.call()) {
f.cancel(true);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2002,31 +2002,7 @@ public void testInterruptToObservableOnTimeout() throws InterruptedException {
assertTrue(cmd.hasBeenInterrupted());
}

@Test
public void testDoNotInterruptObserveOnTimeoutIfPropertySaysNotTo() throws InterruptedException {
// given
InterruptibleCommand cmd = new InterruptibleCommand(new TestCircuitBreaker(), false);

// when
cmd.observe().subscribe();

// then
Thread.sleep(500);
assertFalse(cmd.hasBeenInterrupted());
}

@Test
public void testDoNotInterruptToObservableOnTimeoutIfPropertySaysNotTo() throws InterruptedException {
// given
InterruptibleCommand cmd = new InterruptibleCommand(new TestCircuitBreaker(), false);

// when
cmd.toObservable().subscribe();

// then
Thread.sleep(500);
assertFalse(cmd.hasBeenInterrupted());
}

@Override
protected void assertHooksOnSuccess(Func0<TestHystrixObservableCommand<Integer>> ctor, Action1<TestHystrixObservableCommand<Integer>> assertion) {
Expand Down Expand Up @@ -5553,7 +5529,7 @@ public void call(Subscriber<? super Boolean> s) {
s.onCompleted();
}

}).subscribeOn(Schedulers.computation());
}).subscribeOn(Schedulers.io());
}

@Override
Expand Down Expand Up @@ -5586,7 +5562,7 @@ protected Observable<Boolean> construct() {
@Override
public Observable<Boolean> call() {
try {
Thread.sleep(2000);
Thread.sleep(1000);
}
catch (InterruptedException e) {
System.out.println("Interrupted!");
Expand Down

0 comments on commit 30c94ad

Please sign in to comment.