Skip to content

#1308 Switch to JUnit Jupiter and do not use Toolchains for the integration tests#2013

Merged
filiphr merged 2 commits into
mapstruct:masterfrom
filiphr:1308_integration-tests-jupiter
Feb 3, 2020
Merged

#1308 Switch to JUnit Jupiter and do not use Toolchains for the integration tests#2013
filiphr merged 2 commits into
mapstruct:masterfrom
filiphr:1308_integration-tests-jupiter

Conversation

@filiphr

@filiphr filiphr commented Feb 1, 2020

Copy link
Copy Markdown
Member

The CI should be setup to run on different Java versions, for which the integration tests are going to be run

Travis is currently running Java 8, 11, 13 and EA.

I'll update to GitHub Actions eventually as well

Fixes #1308

@filiphr filiphr requested a review from sjaakd February 1, 2020 10:01

@sjaakd sjaakd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey Filip.. this is sure a lot to take in. A really good job to move to Juniper. 💯

I went trough it. Find it a bit tricky to grasp. Perhaps its a good idea to also request @agudian to glance upon this. He's really good in all this junit stuff and perhaps he's got some time. If not, just merge. I think we need to go with this anyway and I can see we scrap a lot of code in favour of standard stuff in juniper.

/**
* Adds explicit exclusions of test mappers that are known or expected to not work with specific compilers.
*
* @author Andreas Gudian

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this really the author?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes this was within the FullFeatureTest and was written by Andreas


switch ( currentJreVersion ) {
case JAVA_9:
// TODO find out why this fails:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

did you investigate this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope, this is an old TODO :), so I left it

JRE currentJreVersion) {
List<String> additionalExcludes = new ArrayList<>();

// SPI not working correctly here.. (not picked up)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we fix this in a later phase? Make an issue? I guess we rely heavily on SPI.. I guess somewhere the META_INF is not on the classpath.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This comes from earlier, I didn't write a single new line in this class. Just pulled it outside of the deleted FullFeatureTest. I actually have a better idea now with Jupiter instead of doing what we are doing here.

* Otherwise, use <code>-Dmapstruct_root=path_to_project</code>.
*/
@RunWith( Parameterized.class )
@DisabledForJreRange(min = JRE.JAVA_11)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cool, I guess this is the trick that allows you to scrap a lot of plumbing..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yup this is a Jupiter annotation which disables the test to run on Java 11+. Which is not correct, I should disable it from 12+. But yes it has a lot of good conditions that can be used. Have a look at the package and the other conditions.


@Test
public void testUpToDate() throws IOException {
@ParameterizedTest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cool feature..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh yes, I love the JUnit Jupiter parametrized tests. They are extremely powerful.

@filiphr

filiphr commented Feb 2, 2020

Copy link
Copy Markdown
Member Author

Hey Filip.. this is sure a lot to take in. A really good job to move to Jupiter. 💯

Thanks, I love Jupiter and would slowly move the other tests towards there as well.

I went trough it. Find it a bit tricky to grasp. Perhaps its a good idea to also request @agudian to glance upon this. He's really good in all this junit stuff and perhaps he's got some time. If not, just merge. I think we need to go with this anyway and I can see we scrap a lot of code in favour of standard stuff in juniper.

The most complex logic (the one using the Verifier) is in ProcessorInvocationInterceptor#doExecute which is the same logic which existed before in the ProcessorSuiteRunner.

In any case I'll write to @agudian to see if he can have a brief look.

@filiphr filiphr force-pushed the 1308_integration-tests-jupiter branch from ee95b2a to 49413d4 Compare February 2, 2020 13:55
…the integration tests

The CI should be setup to run on different Java versions, for which the integration tests are going to be run

@agudian agudian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, Filip!

Always nice to be able to delete a lot of code without losing anything! 👍

In a more complex build pipeline, you could even think of building the artifacts with our default JDK version (8?) and use these exact jar files in the integration tests spawned as matrix build. I bet that can be modelled with GitHub actions.

Anyway, getting rid of the toolchains in favor of matrix builds is a good step.

@filiphr

filiphr commented Feb 3, 2020

Copy link
Copy Markdown
Member Author

Thanks a lot for the review Andreas.

In a more complex build pipeline, you could even think of building the artifacts with our default JDK version (8?) and use these exact jar files in the integration tests spawned as matrix build. I bet that can be modelled with GitHub actions.

This is actually a great idea and not difficult at all with GitHub Actions. Would put it in the ideas for migrating there.

@filiphr filiphr mentioned this pull request Feb 3, 2020
4 tasks
@filiphr filiphr merged commit 02a113b into mapstruct:master Feb 3, 2020
@filiphr filiphr deleted the 1308_integration-tests-jupiter branch March 7, 2020 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable integration tests to run on Java 9

3 participants