Expand tests to verify multipart structure and body content#1557
Open
Faheem12005 wants to merge 1 commit intojenkinsci:mainfrom
Open
Expand tests to verify multipart structure and body content#1557Faheem12005 wants to merge 1 commit intojenkinsci:mainfrom
Faheem12005 wants to merge 1 commit intojenkinsci:mainfrom
Conversation
|
@Faheem12005 The findFirstPartByContentType() helper looks good overall but one thing worth considering: the recursive call has no depth limit. For deeply or maliciously nested MimeMultipart structures this could theoretically lead to a stack overflow. Since this is test code it's low risk but adding a simple depth guard (e.g. maxDepth parameter) would make it more robust. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves the TODO in
testShouldSendEmailUsingUtf8ByDefaultthis PR tightens and broadens multipart validation by enforcing expected MIME structure and body-part semantics across relevant tests.
testShouldSendEmailUsingUtf8ByDefaultpreviously had a silent fallback for if the message wasn't aMimeMessage. I've replaced this with a stricter assertion so potentially broken email implementations don't pass through.Defined a new helper
assertMultipartSubtypeto verify the multipart subtypes (eg: mixed, alternative) on both the outer message header and the parsedMimeMultipartobject, and applied it to existing tests to increase multipart coverage.Testing done
Modifications to tests only
Submitter checklist