Skip to content

Commit

Permalink
Merge pull request Netflix#1028 from mattrjacobs/deflake-observableco…
Browse files Browse the repository at this point in the history
…mmand-semaphore-unit-test

Add a sleep to get a more deterministic unit test result
  • Loading branch information
mattrjacobs committed Dec 29, 2015
2 parents 05e6e63 + fbf3b4b commit 4d4f225
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,12 @@ public void run() {
Thread t3 = new Thread(r3);

t2.start();
try {
Thread.sleep(100);
} catch (Throwable ex) {
fail(ex.getMessage());
}

t3.start();
try {
t2.join();
Expand All @@ -1005,6 +1011,9 @@ public void run() {
fail("We expected an exception on the 2nd get");
}

System.out.println("CMD1 : " + command1.getExecutionEvents());
System.out.println("CMD2 : " + command2.getExecutionEvents());
System.out.println("CMD3 : " + command3.getExecutionEvents());
assertCommandExecutionEvents(command1, HystrixEventType.EMIT, HystrixEventType.SUCCESS);
assertCommandExecutionEvents(command2, HystrixEventType.EMIT, HystrixEventType.SUCCESS);
assertCommandExecutionEvents(command3, HystrixEventType.SEMAPHORE_REJECTED, HystrixEventType.FALLBACK_MISSING);
Expand Down

0 comments on commit 4d4f225

Please sign in to comment.