Skip to content

Bump Spring Boot to 4.2.0, migrate tests to JUnit 5 and speed up CI - #1102

Merged
aaronzi merged 10 commits into
mainfrom
dependabot/maven/org.springframework.boot-spring-boot-starter-parent-4.2.0
Nov 23, 2026
Merged

aaronzi merged 10 commits into
mainfrom
dependabot/maven/org.springframework.boot-spring-boot-starter-parent-4.2.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description of Changes

Dependabot's bump of spring-boot-starter-parent from 4.1.2 to 4.2.0 could not be merged: CI hung for hours and the build failed. This PR contains the bump plus everything needed to get it green, a full migration of the test suite from JUnit 4 to JUnit 5, and a reworked CI setup that cuts its runtime by more than half.

1. Spring Boot 4.2.0 (Dependabot)

Spring Boot 4.2.0 manages Surefire 3.6.1, which no longer ships JUnit 4 providers. The surefire-junit47 provider pinned in the root pom.xml could no longer be resolved, so every build failed.

2. CI no longer hangs on repo.eclipse.org

The dash-licenses-snapshots plugin repository was declared globally. Maven therefore asked repo.eclipse.org before Maven Central for every plugin. While that host answered 503 with Retry-After, every build stalled for hours. The repository is now scoped to the DashLicense and docker-push profiles, the only places that use license-tool-plugin, and limited to snapshots.

3. Test suite migrated from JUnit 4 to JUnit 5

  • Mechanical migration with the OpenRewrite JUnit4to5Migration recipe: annotations, assertions, expected= to assertThrows, Parameterized to @ParameterizedTest, TemporaryFolder to @TempDir.
  • junit and junit-vintage-engine replaced by junit-jupiter. The two registry basetests modules keep their tests in src/main, so they get junit-jupiter at compile scope.
  • @RunWith(SpringRunner.class) removed. Where @SpringBootTest/@WebMvcTest don't already register the Spring extension, it is replaced by @ExtendWith(SpringExtension.class).
  • Registry TestResourcesLoader was a JUnit 4 TestName rule. It is now a BeforeEachCallback extension used via @RegisterExtension, with the same API.
  • The TCK test applications run through the JUnit Platform Launcher instead of JUnitCore.
  • AASEnvironmentIT is now a JUnit Platform @Suite (junit-platform-suite).

JUnit 4 and JUnit 5 treat inheritance and test order differently, and the automated migration does not cover that. These cases were fixed by hand:

  • Lifecycle annotations on overrides: under JUnit 5, overriding methods no longer inherit lifecycle annotations. @BeforeEach is restored on 7 reset methods that used to inherit @Before and @After.
  • Expected exceptions on overrides: overrides no longer inherit the base test's expected=.
    • The client-specific MissingIdentifierException assertions now use a shared helper, updateExistingSubmodelUsingMismatchingId().
    • A redundant MongoDB override is removed.
    • The unimplemented client invokeNonOperation placeholders are now empty TODO overrides.
  • Static lifecycle methods: under JUnit 6, a subclass's static @BeforeAll no longer hides the parent's, so both ran. The AAS Environment client tests are therefore split into the abstract ConnectedAasEnvironmentTestSuite and ConnectedAasManagerTestSuite, with concrete unsecured and authorized subclasses.
  • Test order: the default method order changed. The authorized AAS Service and Submodel Service client tests had only passed because an earlier test had already set the security context; they now authenticate the test thread before each test.

4. Tests that never ran before now run

The forced JUnit 4 provider silently skipped every JUnit 5 and TestNG test class. They run now:

Job Before After Newly running
AAS Registry 657 671 DiscoveryIntegrationAasRegistryTest
AASX FileServer 126 136 TestAASXFileServerHTTP (TestNG)
Submodel Service 428 493 TestAuthorizedSubmodelService, AuthorizedSubmodelServiceFileStreamTest, SubmodelRegistration*Test (4 classes), TestSubmodelServiceHTTP
All other jobs unchanged
Total 3,778 3,867

Two of the newly running tests (SubmodelRegistrationAuthorizationTest and SubmodelRegistrationUnAuthorizedTest) requested tokens from localhost:9097, which the CI environment does not provide. They now use the same Keycloak endpoint as the Submodel Repository registry tests.

5. Faster CI

Most of the "Build and Test BaSyx" runtime was setup that each of its 12 jobs repeated:

  • No redundant apt-get in the Dockerfiles. Every Dockerfile ran apt-get update && apt-get install -y ca-certificates, which downloads the full Ubuntu package index and took up to 8 minutes per build on slow mirrors. eclipse-temurin:17 already ships ca-certificates (and curl for the health checks), so the step is removed from all 16 Dockerfiles. Checked locally: the image starts, reports healthy and makes HTTPS requests.
  • Docker layer cache. Images were built with noCache, so the identical apt-get layer was rebuilt for every image, taking up to 7 minutes on slow Ubuntu mirrors. noCache is now configurable through docker.noCache. The default stays true, so release builds are unchanged. The CI workflows disable it through MAVEN_ARGS.
  • Fewer images. Each job built 7 images, but the CI environment only uses 4. Only those are built now, in one Maven invocation.
  • Earlier infrastructure start. MongoDB, Kafka, Keycloak, Elasticsearch and nginx start before the Maven build, so they boot in parallel with it.
  • Kibana on demand. No test uses it, so it moved behind a kibana compose profile. Locally: docker compose --project-directory ./ci --profile kibana up.
  • BaSyx Common tests once. They now run only in the BaSyx Core job, not in all 11 jobs.
  • Maven flags. The reactor builds with -T 1C and without download progress output.
Workflow (wall time) Before After
Build and Test BaSyx 25–31 min ~12 min (jobs 6–12 min)
Test Examples ~20 min 4–5 min per job
Build and Start Docker Images 8–10 min ~4 min

Related Issue

Supersedes #1104, which contained only the repo.eclipse.org fix (section 2) and has been closed.

BaSyx Configuration for Testing

None. All CI checks pass.

AAS Files Used for Testing

None.

Additional Information

  • Authorized registry tests are slower. They take about 0.5 s more per test since the migration (about +25 s per module in the AAS Registry job). The test code changed only mechanically; the cause is not yet known.
  • Dependabot will not rebase this branch. It now contains manual commits, so if main moves, the branch needs a manual rebase. Do not comment @dependabot recreate, as that would discard these commits.
  • Dead test file. basyx.aasregistry/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/test/java/MongoDbAasTransactionsIT.java is not part of any module. It was migrated for consistency but could be deleted.

Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 4.1.2 to 4.2.0.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](spring-projects/spring-boot@v4.1.2...v4.2.0)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-version: 4.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file java Pull requests that update Java code labels Nov 23, 2026
The dash-licenses-snapshots plugin repository was declared globally, so
Maven queried repo.eclipse.org before Maven Central for every plugin.
While repo.eclipse.org answers with 503 and Retry-After, Maven Resolver
keeps waiting and retrying, so every CI build stalls for hours.

Move the repository into the DashLicense and docker-push profiles, which
are the only ones using license-tool-plugin, and limit it to snapshots.
Spring Boot 4.2 manages maven-surefire-plugin 3.6.1, which no longer
ships the JUnit 4 providers, so the pinned surefire-junit47 provider
cannot be resolved and every build fails.

Drop the explicit provider and add junit-vintage-engine as a test
dependency so the existing JUnit 4 tests keep running alongside the
JUnit Jupiter tests.
Surefire 3.6 (managed by Spring Boot 4.2) only runs tests through the
JUnit Platform. Instead of keeping the JUnit 4 tests alive with the
deprecated vintage engine, migrate them to JUnit Jupiter.

- Convert annotations, assertions, expected exceptions, Parameterized
  tests and TemporaryFolder to their Jupiter equivalents (OpenRewrite
  JUnit4to5Migration plus manual fixes)
- Drop @RunWith(SpringRunner.class) where @SpringBootTest/@WebMvcTest
  already register the SpringExtension, use
  @ExtendWith(SpringExtension.class) elsewhere
- Turn the registry TestResourcesLoader rule into a BeforeEachCallback
  extension registered with @RegisterExtension
- Run the TCK test applications through the JUnit Platform Launcher
- Replace the AASEnvironmentIT JUnit 4 suite with a JUnit Platform suite
- Replace junit/junit-vintage-engine dependencies with junit-jupiter
These JUnit 5 tests never ran before because Surefire was forced onto
the JUnit 4 provider. They requested tokens from localhost:9097, which
the CI environment does not provide. Use the same token endpoint as the
Submodel Repository registry integration tests.
JUnit 4 and JUnit Jupiter differ in how test and lifecycle annotations
interact with inheritance, which the automated migration did not cover:

- Overriding methods no longer inherit lifecycle annotations: restore
  @beforeeach on the reset methods that inherited @before and @after
- Overrides no longer inherit expected exceptions: assert the
  client-specific MissingIdentifierException on a shared helper, drop a
  redundant MongoDB override and turn the unimplemented client
  invokeNonOperation placeholders into no-ops
- Static lifecycle methods no longer hide superclass ones, so both ran
  and the authorized AAS Environment client tests failed with "port in
  use": split the base tests into abstract suites with concrete
  unsecured and authorized subclasses
- Test methods run in a different order: authenticate the test thread
  before each authorized AAS Service test instead of relying on an
  earlier test having done so
…nt test

Same hidden test-order dependency as the authorized AAS Service test:
the base suite accesses the secured repository bean directly and only
passed under JUnit 4 because an earlier test had set the security
context.
Most of the Build and Test BaSyx runtime went into setup that every one
of the twelve jobs repeated:

- Docker images were built with noCache, so the identical apt-get layer
  was rebuilt for every image (up to 7 minutes each on slow mirrors).
  Make noCache configurable via docker.noCache (default stays true for
  releases) and disable it in the CI workflows through MAVEN_ARGS.
- Each job built seven images, but the CI environment only uses four.
  Build just those, in one Maven invocation.
- Start the infrastructure containers (MongoDB, Kafka, Keycloak,
  Elasticsearch, nginx) before the Maven build so they boot in parallel.
- Kibana is not used by any test; move it behind a "kibana" compose
  profile instead of waiting for it in every job.
- Run the BaSyx Common tests only in the BaSyx Core job instead of in all
  eleven jobs.
- Build the reactor with -T 1C and without download progress output.
The automated migration wrote fully qualified @org.junit.jupiter.api.Test
annotations in a few classes; import the annotation like everywhere else.
The eclipse-temurin:17 base image already ships ca-certificates (and
curl for the health checks). The extra apt-get update downloads the full
Ubuntu package index on every build, which took up to 8 minutes per image
in CI on slow mirrors.
@aaronzi aaronzi changed the title Build(deps): Bump org.springframework.boot:spring-boot-starter-parent from 4.1.2 to 4.2.0 Bump Spring Boot to 4.2.0, migrate tests to JUnit 5 and speed up CI Nov 23, 2026
@aaronzi
aaronzi merged commit a41e524 into main Nov 23, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant