feat(integration): add real Spring Boot 3.x/4.x integration tests - #1361
Conversation
There was a problem hiding this comment.
Pull request overview
Adds end-to-end Spring Boot integration coverage by running real Spring Boot 3.x/4.x fixtures (downloaded from java-test-applications) and asserting buildpack framework injection behavior (notably java-cfenv, plus combined framework scenarios).
Changes:
- Add real-jar Spring Boot integration tests (SB3 + SB4) including assertions for cloud profile activation and jar/agent presence.
- Add a helper that downloads and pre-explodes Spring Boot fat jars to match CF staging behavior.
- Update docs and a previously dead fixture URL reference.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/java/containers/spring_boot.go | Clarifies isSpringBootJar fallback heuristic behavior via comments. |
| src/integration/spring_boot_test.go | Adds new real Spring Boot SB3/SB4 integration test contexts and assertions. |
| src/integration/README.md | Updates Go test invocation examples and documents -run patterns for deep spec subtests. |
| src/integration/init_test.go | Downloads/explodes SB3/SB4 fixtures before running the integration suite and wires paths into SpringBoot tests. |
| src/integration/frameworks_test.go | Updates a jar URL in the (currently skipped) Checkmarx IAST binding test. |
| src/integration/fixtures_helper_test.go | Introduces jar download + zip extraction utilities to produce exploded fixture directories. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4c1851e to
7b93092
Compare
…oudfoundry#1357) Add integration tests using real fat jars from cloudfoundry/java-test-applications v1.0.0 to verify end-to-end framework injection. Three tests: - SB3 (Boot 3.5, Java 17): java-cfenv 3.x injection, cloud profile verified via RuntimeLogs (boot3 app lacks RuntimeUtils endpoints) - SB4 (Boot 4.1, Java 21): java-cfenv 4.x injection, cloud profile via /active-profiles, java-cfenv presence via /loaded-jars - SB4 combined: java-cfenv + container-security-provider env var + cf-metrics-exporter javaagent — all in one deployment Key design decisions: - Pre-explode fat jars in fixtures_helper_test.go for Docker-mode tests to simulate CF staging (CF bits service extracts pushed jars as zip before running the buildpack). CF-mode tests pass raw jar to cf push. See switchblade#134 for CF-vs-Docker divergence. - Jars sourced from cloudfoundry/java-test-applications@v1.0.0. Also: - Fix dead 404 URL in frameworks_test.go - Update isSpringBootJar comment in spring_boot.go - Update README with correct 5-level -run filter patterns
7b93092 to
1ff2898
Compare
| suite("Play", testPlay(platform, fixtures)) | ||
|
|
||
| // Container detection error tests | ||
| suite("ContainerDetection", testContainerDetectionErrors(platform, fixtures)) |
There was a problem hiding this comment.
@stokpop note that the build fails in https://concourse.app-runtime-interfaces.ci.cloudfoundry.org/teams/buildpacks-team/pipelines/java-buildpack/jobs/specs-switchblade-docker-cflinuxfs4/builds/144 with:
go: downloading github.com/google/subcommands v1.2.0
go: downloading github.com/cenkalti/backoff/v4 v4.2.0
# github.com/cloudfoundry/java-buildpack/src/integration_test [github.com/cloudfoundry/java-buildpack/src/integration.test]
src/integration/init_test.go:103:30: undefined: testContainerDetectionErrors
FAIL github.com/cloudfoundry/java-buildpack/src/integration [build failed]
FAIL
There was a problem hiding this comment.
@kiril-keranov thanks for noticing. Is there a way to test branches before the merge? In this case I tested locally, and it uses some unstaged empty dirs that were not present in the merged code (git does not work with empty dirs). It only fails locally with a complete fresh checkout that then also misses these empty dirs.
Made a followup fix PR: #1404, can you have a look? Thanks
There was a problem hiding this comment.
@stokpop We might think of introducing some PR validation jobs to run the tests. I also run the tests locally, don't think there is possibility currently for central test run on PR changes
Fixes #1357
What
Add integration tests using real Spring Boot fat jars from cloudfoundry/java-test-applications v1.0.0 to verify end-to-end framework injection.
Three tests:
/active-profiles, jar presence via/loaded-jars, JDBC auto-config (spring.datasource.url/username/password)Also includes:
fixtures_helper_test.go: downloads jars, pre-explodes for Docker mode (CF staging does this natively)framework-java-cfenv.md: new VCAP_SERVICES auto-configuration section documenting java-cfenv-all service connector pipelineframeworks_test.go-runfilter patternsTest assertions backed by docs:
CfEnvProcessor)spring.datasource.url=jdbc:postgresql://...(frompostgres://URI viaCfDataSourceEnvironmentPostProcessor)spring.datasource.username/spring.datasource.passwordextraction