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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUREFIRE-1654] Remove deprecated forkMode parameter #575

Conversation

SimonBaars
Copy link
Contributor

The forkMode parameter has been deprecated in Surefire 2.14, and with the upcoming 3.0 release, it's finally time to remove the parameter once and for all.

Reviewer instructions

Removing the forkMode ended up being a quite comprehensive change. Throughout the refactoring/restructuring process, I ran the tests and integration tests often, to ensure equivalent behavior. I re-purposed most forkMode tests to test the forkCount parameter, removing a few that were per definition redundant.

Each commit should address a "sub-issue" I had to tackle to remove the forkMode. If the entire diff looks daunting, I can recommend reviewing commit-by-commit. Each commit should be a version that compiles on its own.

Here are a few more pointers for reviewing:

  • Read this article about migrating forkMode to forkCount.
  • Start with the first commit, where I remove the most important traces of the forkMode parameter, before moving on to the entire diff.
  • I removed the migration guide from the docs. Is that okay or would we like to keep it up for now?
  • I left some convenience methods for the different fork modes in the SurefireLauncher, let me know if you'd like me to unfold that.
  • I avoided the term "fork mode" as much as possible, but still left some traces where it made sense.

What's next?

While working on this, I noticed a few codebase styling issues that I'd like to refactor. To keep the diff of this PR sensible, I decided it would be better to open a separate PR for that. So you can expect another PR incoming 馃槈

Checklist

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SUREFIRE-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace SUREFIRE-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean install).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

License

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@SimonBaars
Copy link
Contributor Author

Hey, I'm aware of the integration test failures and will try to address them tomorrow.

Copy link
Contributor

@mthmulders mthmulders left a comment

Choose a reason for hiding this comment

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

Thanks for this thorough work, @SimonBaars! I also appreciate your "reviewers' guide".

I think the proposed changes introduce a few duplicate lines - nothing too serious in terms of damage caused, but let's make sure the code is left better than when we first found it.

We should make sure that the migration guide (how to get away from forkMode) ends up somewhere in the release announcements of Surefire 3.0.0 (and if there's a milestone release in between, maybe there as well).

Finally, I'd appreciate it if somebody else with knowledge about Surefire could review these changes, too.

@SimonBaars
Copy link
Contributor Author

We should make sure that the migration guide (how to get away from forkMode) ends up somewhere in the release announcements of Surefire 3.0.0 (and if there's a milestone release in between, maybe there as well).

I don't know how to do this. Will you pull this?

@SimonBaars
Copy link
Contributor Author

Hey, I resolved the failing tests (except for ubuntu-latest jdk-18-temurin, but that also fails onmaster). Can someone else do a review? Maybe @slawekjaranowski since you also chipped in on the other PR 馃槉

@SimonBaars
Copy link
Contributor Author

@mthmulders We need another review for this PR, so ideally it won't lay dormant for too long. Do you know someone to include?

@mthmulders
Copy link
Contributor

We should make sure that the migration guide (how to get away from forkMode) ends up somewhere in the release announcements of Surefire 3.0.0 (and if there's a milestone release in between, maybe there as well).

I don't know how to do this. Will you pull this?

In hindsight, it might be a better approach to keep the content in maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm. We should update it - instead of

Although that parameter is still supported for backward compatibility, users are strongly encouraged to migrate their configuration and use <<<forkCount>>> and <<<reuseForks>>> instead.

We might want to go for something like

Starting with 3.0.0-M8, this parameter is no longer available. Users should have migrated their configuration to use <<<forkCount>>> and <<<reuseForks>>> instead.

@michael-o
Copy link
Member

michael-o commented Nov 15, 2022

@SimonBaars Thank you for the massive work. I guess we owe you a pack of Amstel.

  • Did you try a custom build against our Core ITs?
  • Did you search our [https://github.com/apache/maven-sources/tree/submodules](Maven Sources] for this deprecated param, replace and see how it goes?

@slawekjaranowski
Copy link
Member

@SimonBaars Thanks ... I will try to review and test in a few days

@slawekjaranowski
Copy link
Member

First check:

  • org.apache.maven.surefire.api.provider.SurefireProvider - forkMode in comments - to think, discover correct descriptions

  • org.apache.maven.surefire.its.jiras.Surefire146ForkPerTestNoSetupIT - mentions test for forkMode=pertest - check if is still needed

  • surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml - forkMode=pertest in description

Copy link
Member

@slawekjaranowski slawekjaranowski left a comment

Choose a reason for hiding this comment

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

Looks ok for me.

Local test ok, tested with it test and with Maven core-its

@slawekjaranowski slawekjaranowski force-pushed the SUREFIRE-1654-remove-deprecated-forkmode branch from 21e6bc8 to 80adc4f Compare December 20, 2022 16:50
Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

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

If Slawek approves then I can I approve as well.

@slawekjaranowski
Copy link
Member

Nobody knows - but every removed line of code can help for simplify, so be brave and go forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants