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

Catch known exceptions (broken pipe) #1042

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

mocenas
Copy link
Contributor

@mocenas mocenas commented Feb 13, 2024

Summary

Add mechanism to catch known exception and make affected tests skipped, not failed. Motivation for this is to not have failed tests, because of known issues, which cannot be easily disabled - such as quarkusio/quarkus#38334.

To catch this single issue, it should be sufficient to catch exceptions just in QuarkusScenarioBootstrap (I'm not entire sure if it would be enough). But extending it also to test annotation makes it cover this exception also in tests.

Same mechanism can be used to catch any other known exception in the future.

Please check the relevant options

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Dependency update
  • Refactoring
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • This change requires execution against OCP (use run tests phrase in comment)

Checklist:

  • Example scenarios has been updated / added
  • Methods and classes used in PR scenarios are meaningful
  • Commits are well encapsulated and follow the best practices

@mocenas mocenas requested a review from mjurc February 13, 2024 10:11
@mocenas mocenas marked this pull request as draft February 13, 2024 10:12
@mocenas
Copy link
Contributor Author

mocenas commented Feb 13, 2024

WDYT @mjurc ?

/**
* List of known exception messages. If you want to mask any exception, add its message here
*/
private static final List<String> KNOWN_EXCEPTION_MESSAGES = List.of("Broken pipe");
Copy link
Member

Choose a reason for hiding this comment

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

The Broken pipe will be included in the issues we are experiencing now on Podman, but if we ever experience it in a different context then we do right now, it will be logged and skipped. I won't pretend I really do read logs of green jobs.

This, very unlikely, could hide problems. I'm not sure about:

  1. plain string which doesn't allow for complex pattern like parts of stack trace
  2. if we go by log lines, you will probably have a hard time to determine what is in the stack trace as it is not one line?
  3. if we only experience this on Podman, you could only make it known problem on Podman. Our FW already knows whether it is Podman or Docker as we check it on every single run where containers are used.

Maybe you could make it a predicate consuming throwable?

Copy link
Member

@mjurc mjurc left a comment

Choose a reason for hiding this comment

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

@michalvavrik I wouldn't mind your opinion about architecture of this either btw.

/**
* List of known exception messages. If you want to mask any exception, add its message here
*/
private static final List<String> KNOWN_EXCEPTION_MESSAGES = List.of("Broken pipe");
Copy link
Member

Choose a reason for hiding this comment

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

I like the approach of making this a Junit extension, but I really think this bit should be configurable from testsuite or command line. Can it be configured from properties?

Copy link
Member

Choose a reason for hiding this comment

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

+1 though it's hard to combine with my suggestion, you can treat it as one of, I'll leave it on you

@michalvavrik
Copy link
Member

@michalvavrik I wouldn't mind your opinion about architecture of this either btw.

one step ahead of you, I commented first :-D

@mocenas
Copy link
Contributor Author

mocenas commented Feb 13, 2024

The think is - do we rather want to have it configured via CLI (something like -DignoreBrokenPipe=true). Or have a generic solution for ignoring exceptions?
I proposed this "generic" solution just as a draft I don't know if there is a real usage for it. And if I should follow @michalvavrik 's suggestions, it is going to be even more complex.
But if we want to manually enable/configure it via CLI IMHO it's not feasible (read not worth it) to make it generic.

If we really want to have it configured (or at least enabled) via CLI, then I propose to reduce this to one-sides feature, for broken pipe exclusively, and have it enabled via something like -DignoreBrokenPipe=true. Opinions @mjurc @michalvavrik ?

@michalvavrik
Copy link
Member

michalvavrik commented Feb 13, 2024

I agree with your assessment, although I think it's pretty easy to change it to a predicate as you basically c&p what you have into a predicate.

I'd prefer to have this enabled on demand with system property. Unless we run into an issue that is omnipresent in the future. I'd suggest -Dts.global.ignore-known-issue=broken-pipe. (I absolutely don't care how you name it, please use your name).

@mocenas
Copy link
Contributor Author

mocenas commented Feb 13, 2024

I've changed the checker to use predicates, as @michalvavrik suggested. Now it requires a system property to be effective and you can choose which predicates to use for exception ignoring. To ignore broken pipe, start maven job with mvn .... -Dts.global.ignore-known-issue=broken-pipe.
But it supports usage such as mvn .... -Dts.global.ignore-known-issue=broken-pipe, my-failure, foo-handler, bar-handler.

Copy link
Member

@mjurc mjurc left a comment

Choose a reason for hiding this comment

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

Thanks!

@mocenas mocenas changed the title DRAFT: Catch known exceptions (broken pipe) Catch known exceptions (broken pipe) Feb 13, 2024
@mocenas mocenas marked this pull request as ready for review February 13, 2024 15:09
@mocenas
Copy link
Contributor Author

mocenas commented Feb 13, 2024

@michalvavrik waiting for your review. If you like this PR, feel free to merge it (and squash it).

Copy link
Member

@michalvavrik michalvavrik left a comment

Choose a reason for hiding this comment

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

lgtm

@michalvavrik michalvavrik merged commit adb402f into quarkus-qe:main Feb 13, 2024
7 checks passed
@mocenas mocenas deleted the hide_broken_pipe branch February 14, 2024 07:51
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.

3 participants