Extract fault injection points#5
Conversation
Signed-off-by: see-quick <maros.orsak159@gmail.com>
Signed-off-by: see-quick <maros.orsak159@gmail.com>
| * @param shouldFail whether to throw | ||
| * @param exception the exception to throw | ||
| */ | ||
| static void maybeInjectFailure(boolean shouldFail, RuntimeException exception) { |
There was a problem hiding this comment.
What's the case I should call this method with false so it would do nothing, instead of not calling it at all? What's the advantage of not having the caller making such decision?
There was a problem hiding this comment.
You mean like this?
if (config.getBoolean(...)) {
injectFailure(... ); // here exception ));
} There was a problem hiding this comment.
Thinking more, it's weird having a method which just raise an exception as it was weird before having the same method raising an exception based on a flag as input parameter, but I guess we don't have something better. Unless the utility class should get the configuration behind the scenes and reading the flag to decide if raising the exception or not. But tbh at this point, I don't know, it's better getting more opinions from other @strimzi/maintainers
Signed-off-by: see-quick <maros.orsak159@gmail.com>
This PR extract fault injection points into dedicated util class.