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

Maven surefire uses wrong provider for Spring Batch Core #4121

Closed
hpoettker opened this issue Jun 7, 2022 · 2 comments
Closed

Maven surefire uses wrong provider for Spring Batch Core #4121

hpoettker opened this issue Jun 7, 2022 · 2 comments

Comments

@hpoettker
Copy link
Contributor

Issue

There are failing tests in Spring Batch Core. Both on the main branch and in the release 5.0.0-M3. They are in the classes

  • InlineDataSourceDefinitionTests
  • JobBuilderConfigurationTests
  • JobLoaderConfigurationTests
  • TransactionManagerConfigurationWithBatchConfigurerTests
  • TransactionManagerConfigurationWithoutBatchConfigurerTests
  • ConcurrentTransactionTests

During a Maven build currently no tests are executed in Spring Batch Core as Maven Surefire chooses the provider for JUnit 5 while all tests are written in JUnit 4 and the JUnit 5 vintage engine is not on the classpath. This can be verified by executing e.g.

./mvnw clean test -pl spring-batch-core

Root cause

The tests have been effectively disabled in #4065 by the change in the pom.xml of Spring Batch Core: https://github.com/spring-projects/spring-batch/pull/4065/files#diff-690b0d85920e9a80c4b4883c05b470e89b6bcd42f5721e38625d25b638a548a6

The artifact micrometer-test artifact has transitive dependencies on JUnit Jupiter which leads to Maven Surefire using a Junit 5 provider instead of Junit 4. And the JUnit 5 provider silently ignores the JUnit 4 tests without the vintage engine.

Tests have started failing with the commit 31af573. Since then, some other commit has led to failures in JobLoaderConfigurationTests which did not fail in this commit.

Possible fixes for the build

I think the best solution to get the build working again is to add the JUnit Vintage Engine to Spring Batch Core. If it's added, the tests are again executed as expected.

Alternatively, JUnit Jupiter dependencies could be excluded from micrometer-test. This works too but the problem might resurface easily.

@hpoettker hpoettker added status: waiting-for-triage Issues that we did not analyse yet type: bug labels Jun 7, 2022
@fmbenhassine fmbenhassine added in: build and removed status: waiting-for-triage Issues that we did not analyse yet labels Jun 7, 2022
@fmbenhassine fmbenhassine added this to the 5.0.0-M4 milestone Jun 7, 2022
@fmbenhassine
Copy link
Contributor

Good catch! This will be fixed in priority.

@fmbenhassine
Copy link
Contributor

junit-vintage-engine test dependency has been added to spring-batch-core in 0b2a2c2. Failing tests will be fixed in a separate commit.

Thank you for raising this!

fmbenhassine added a commit that referenced this issue Jul 13, 2022
These tests seem to start failing since 31af573 but were
not caught due to #4121. This commit fixes the tests that
are related to infrastructure beans configuration.

Some other tests seems to have started failing as well but
are not related to this change set. There were temporarily
ignored in this commit and will be addressed separately.

Issue #4121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants