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

iss1600: Wrong hystrix event type for fallback missing #1616

Merged
merged 1 commit into from
Jul 3, 2017
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 @@ -167,14 +167,6 @@ Object process(Action action) throws Exception {
@Override
protected abstract T run() throws Exception;

/**
* {@inheritDoc}.
*/
@Override
protected T getFallback() {
throw new RuntimeException("No fallback available.", getExecutionException());
}

/**
* Clears cache for the specified hystrix command.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,24 @@ public void testCommandThrowsHystrixBadRequestExceptionWithNoCause() {
}
}

@Test
public void testFallbackMissing(){
try {
userService.getUserWithoutFallback(null, null);
} catch (Exception e) {}

HystrixInvokableInfo<?> command = getHystrixCommandByKey("getUserWithoutFallback");
assertTrue("expected event: FALLBACK_MISSING", command.getExecutionEvents().contains(HystrixEventType.FALLBACK_MISSING));
}

public static class UserService {

@HystrixCommand
public User getUserWithoutFallback(final String id, final String name) {
validate(id, name);
return new User(id, name);
}

@HystrixCommand(fallbackMethod = "fallback")
public Future<User> getUserAsync(final String id, final String name) {
validate(id, name); // validate logic can be inside and outside of AsyncResult#invoke method
Expand Down