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

Clean up file parameter tests #9260

Merged
merged 1 commit into from
May 12, 2024

Conversation

basil
Copy link
Member

@basil basil commented May 10, 2024

While testing the upgrade of Commons FileUpload from v1 to v2, I noticed that QueueTest#fileItemPersistence started failing because the v2 DiskFileItem wasn't serializable with XStream, as it trips up JEP-200 class filtering. Looking at what this test does, it seems like a fairly artificial / contrived test. Back when it was added in commit 06d93cb, FileParameterValue was indeed serializing a FileItem to disk, but that behavior was changed in commit 4dde24e, which (as far as I can tell) also broke the ability to queue a build with a file parameter and have that build successfully execute after a restart (since, even though the queue was saved correctly, the FileParameterValue wouldn't have its FileItem after the restart, resulting in a NullPointerException in the BuildWrapper returned by FileParameterValue#createBuildWrapper)—not that anyone seems to have missed this feature in the intervening decade. I tried various things in the UI but could not get a DiskFileItem to be serialized no matter what I tried, so I am concluding that this isn't possible anymore after commit 4dde24e and that QueueTest#fileItemPersistence is a pointless test that can be deleted. I did at least manage to write a test for the scenario described in JENKINS-13536, something that was apparently attempted in commit 4dde24e, though not successfully.

Testing done

mvn clean verify -Dtest=hudson.model.FileParameterValuePersistenceTest

Proposed changelog entries

N/A

Proposed upgrade guidelines

N/A

Submitter checklist

Desired reviewers

Pinging @daniel-beck / @jglick for their encyclopedic knowledge of ancient Jenkins history to confirm that my above conclusions are correct

Before the changes are marked as ready-for-merge:

Maintainer checklist

@basil basil added the skip-changelog Should not be shown in the changelog label May 10, 2024
@jglick
Copy link
Member

jglick commented May 10, 2024

not that anyone seems to have missed this feature in the intervening decade

And if they did, better to use the file-parameters plugin. The core parameter type has numerous design flaws. Thank you for retroactively adding the test but I would not recommend spending more time on it.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

The form of the test looks good; I have never understood how this parameter type is even supposed to work so I cannot judge whether the asserted behavior is the intended behavior.

@MarkEWaite
Copy link
Contributor

This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback.

/label ready-for-merge

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label May 11, 2024
@NotMyFault NotMyFault merged commit ad571f8 into jenkinsci:master May 12, 2024
16 checks passed
@daniel-beck
Copy link
Member

Belated 👍

which (as far as I can tell) also broke the ability to queue a build with a file parameter and have that build successfully execute after a restart

This also provides an answer to #5174 (comment) -- that it didn't work before anyway. I filed JENKINS-73161 for that (with no plans to pick it up immediately).

@jglick
Copy link
Member

jglick commented May 13, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants