Skip to content

Conversation

@strangelookingnerd
Copy link
Contributor

This PR aims to migrate all tests to JUnit5. Changes include:

  • Migrate annotations and imports
  • Migrate assertions
  • Remove public visibility for test classes and methods
  • Minor clean up

There are two exceptions where tests use rules that have not yet been migrated to JUnit5:

  • DockerServerCredentialsBindingTest using JenkinsSessionRule (migrated from RestartableJenkinsRule)
  • DockerServerCredentialsHandlerTest using JenkinsSessionRule (migrated from RestartableJenkinsRule)

I am well aware that this is a quite large changeset however I hope that there is still interest in this PR and it will be reviewed.
If there are any questions, please do not hesitate to ping me.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

* Migrate annotations and imports
* Migrate assertions
* Remove public visibility for test classes and methods
* Minor code cleanup
@strangelookingnerd strangelookingnerd requested a review from a team as a code owner March 11, 2025 10:34
@jglick jglick added the chore label May 28, 2025
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.junit.jupiter.WithJenkins;

class JCasCTest {
Copy link
Member

Choose a reason for hiding this comment

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

Why the rename?

Copy link
Contributor Author

@strangelookingnerd strangelookingnerd May 28, 2025

Choose a reason for hiding this comment

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

Mhh, I think it was mainly to satisfy my inner Monk. It's the "official" naming, isn't it? Most similar implementations in other plugins are named the same way.

Comment on lines -123 to +135
.grant(Jenkins.READ).everywhere().to("alice", "bob")
.grant(Computer.BUILD).everywhere().to("alice", "bob")
.grant(Jenkins.READ)
.everywhere()
.to("alice", "bob")
.grant(Computer.BUILD)
.everywhere()
.to("alice", "bob")
Copy link
Member

Choose a reason for hiding this comment

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

This sort of gratuitous reformatting makes it harder to review changes. Is this imposed by a limitation of some automated tool?

# Conflicts:
#	src/test/java/org/jenkinsci/plugins/docker/commons/credentials/DockerServerEndpointTest.java
#	src/test/java/org/jenkinsci/plugins/docker/commons/impl/HostOnlyRegistryKeyMaterialFactoryTest.java
#	src/test/java/org/jenkinsci/plugins/docker/commons/impl/RegistryKeyMaterialFactoryTest.java
#	src/test/java/org/jenkinsci/plugins/docker/commons/util/SampleDockerBuilder.java
@strangelookingnerd
Copy link
Contributor Author

@jenkinsci/docker-commons-plugin-developers Kindly requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants