-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-54325][TESTS] Use custom matcher in ExecutorSuite testThrowable #53022
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
base: master
Are you sure you want to change the base?
Conversation
| isFatal: Boolean): Unit = { | ||
| import Executor.isFatalError | ||
|
|
||
| class BeEqualToIsFatal(isFatal: Boolean) extends Matcher[Throwable] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we give it a more descriptive name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, please suggest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@holdenk do you have a suggestion on how to name it? Note the usage, for example:
errorInThreadPool(errorInGuavaCache(e)) should beEqualToIsFatal(depthToCheck >= 3 && isFatal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the usage of this is to see if an error is a fatal error or not (depending on the boolean flag passed in) right? shouldBeFatalError(true or false) makes a bit more sense to be me from a naming point of view, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the usage of this is to see if an error is a fatal error or not (depending on the boolean flag passed in) right?
Almost right, the usage is to check if the unwrapped error is a fatal error or not, depending on the depth and the boolean flag.
shouldBeFatalError(true or false)
- "should" must not be part of the class name. It is already part of the matcher check
- I am OK with "beFatalError", though "e should beFatalError(false)" means "e should not be fatal error".
The difference between 2 is
- The initial naming corresponds to "is equal to
isFatalflag" - The new naming corresponds to "is fatal error (true or false)".
IMO, the first option is preferable, though I am OK with both options.
@holdenk WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@holdenk ?
|
@holdenk Please take a look |
What changes were proposed in this pull request?
Use custom
BeEqualToIsFatalmatcher instead ofassertinExecutorSuite.testThrowableWhy are the changes needed?
assertexpression and make check more readableDoes this PR introduce any user-facing change?
No
How was this patch tested?
execute affected test
Was this patch authored or co-authored using generative AI tooling?
No