Skip to content

Extract fault injection points#5

Open
see-quick wants to merge 3 commits into
strimzi:mainfrom
see-quick:extract-faul-injection-points-into-dedicated-methods
Open

Extract fault injection points#5
see-quick wants to merge 3 commits into
strimzi:mainfrom
see-quick:extract-faul-injection-points-into-dedicated-methods

Conversation

@see-quick
Copy link
Copy Markdown
Member

@see-quick see-quick commented May 15, 2026

This PR extract fault injection points into dedicated util class.

see-quick added 2 commits May 15, 2026 14:04
Signed-off-by: see-quick <maros.orsak159@gmail.com>
Signed-off-by: see-quick <maros.orsak159@gmail.com>
@see-quick see-quick changed the title Extract faul injection points into dedicated methods Extract fault injection points May 15, 2026
@see-quick see-quick requested a review from a team May 15, 2026 12:17
@see-quick see-quick self-assigned this May 15, 2026
@see-quick see-quick added this to the 0.1.0 milestone May 15, 2026
@see-quick see-quick linked an issue May 15, 2026 that may be closed by this pull request
* @param shouldFail whether to throw
* @param exception the exception to throw
*/
static void maybeInjectFailure(boolean shouldFail, RuntimeException exception) {
Copy link
Copy Markdown
Member

@ppatierno ppatierno May 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean like this?

if (config.getBoolean(...)) {
      injectFailure(... ); // here exception ));
}    

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah something like this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update :).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract fault injection points into dedicated methods

2 participants