Skip to content

COG-1141: Testcontainers MySQL harness for @SpringBootTest (Boot 1.5.4 / Java 8) - #335

Open
patrickbradley-cog wants to merge 4 commits into
masterfrom
devin/cog-1141-w0-testcontainers-mysql-harness-for-springboottest-boot-154
Open

patrickbradley-cog wants to merge 4 commits into
masterfrom
devin/cog-1141-w0-testcontainers-mysql-harness-for-springboottest-boot-154

Conversation

@patrickbradley-cog

@patrickbradley-cog patrickbradley-cog commented Sep 30, 2026 •

Copy link
Copy Markdown

Linear: COG-1141

Summary

This is the canonical Testcontainers MySQL harness: with it, mvn verify runs with only Docker and no local MySQL. Boot stays on 1.5.4 and Java on 8.

Non-obvious choices

  • Image is mysql:5.7.44, not the ticket's 8.0 default. The Boot 1.5 BOM ships Connector/J 5.1.42, which fails against MySQL 8 (Unknown system variable 'query_cache_size') and cannot do caching_sha2_password. Move to 8.0 together with the W3 Connector/J bump (COG-1148 owns the version decision). This PR does not touch runtime dependencies. You can override the image without a code change: -Dtest.mysql.image=....
  • useSSL=false is appended to the JDBC URL. Current Temurin 8 builds disable TLSv1/1.1, and that is what Connector/J 5.1 negotiates.
  • Docker API version: the docker-java shaded into Testcontainers 1.19.x defaults to API 1.32, which Docker Engine 25+ rejects (client version 1.32 is too old). When neither api.version nor DOCKER_API_VERSION is set, the base class sets api.version = min(1.44, daemon max). The daemon max comes from docker [--context default] version --format {{.Server.APIVersion}}. --context default is only added when DOCKER_HOST is unset, so the CLI queries the same endpoint Testcontainers uses. If there is no CLI, it falls back to 1.44. Docker 24 (API 1.43) keeps working.
  • org.testcontainers:junit does not exist on Maven Central (404). JUnit 4 support ships in the core org.testcontainers:testcontainers artifact, so that is what the pom declares, with an explicit 1.19.7 like org.testcontainers:mysql.

Verification (Temurin 8u504, Docker only, nothing listening on :3306)

$ mvn -B -f UserFront/pom.xml clean verify
INFO tc.mysql:5.7.44 - Container mysql:5.7.44 started in PT6.707S
INFO tc.mysql:5.7.44 - Container is started (JDBC URL: jdbc:mysql://localhost:32787/onlinebanking?useSSL=false)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - in com.userFront.UserFrontApplicationTests
[INFO] BUILD SUCCESS

Sibling compatibility check: I copied the smoke tests from #106 (MoneyMovementSmokeTest), #108 (AppointmentSmokeTest) and #109 (AuthSmokeTest) unchanged onto this branch, without their AbstractIntegrationTest copies. All three compile against this harness.

Tests run: 9, Failures: 0 - MoneyMovementSmokeTest
Tests run: 4, Failures: 0 - AppointmentSmokeTest
Tests run: 1, Failures: 0 - UserFrontApplicationTests
Tests run: 5, Failures: 5 - AuthSmokeTest   <- only when run in the same JVM as AppointmentSmokeTest
$ mvn verify -Dtest=AuthSmokeTest  ->  Tests run: 5, Failures: 0

The AuthSmokeTest failures come from test data, not the harness. All classes share one container and one cached context. #108 commits a user smokeuser, and #109 then tries to sign up the same username. /signup returns 200 ("user exists") where the test expects a redirect. One of those PRs needs to use unique usernames when it rebases.

Link to Devin session: https://app.devin.ai/sessions/4e949844d05d4a1a92421b67076d0628
Open in Devin Desktop: https://app.devin.ai/desktop/session/4e949844d05d4a1a92421b67076d0628?variant=devin
Requested by: @patrickbradley-cog


Devin Review

Status Commit
⚪ Not started —

Run Devin Review

Devin Review (Staging)


Devin Review

…4 / Java 8)

Co-Authored-By: patrick.bradley <patrick.bradley@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits September 30, 2026 16:19
Co-Authored-By: patrick.bradley <patrick.bradley@cognition.ai>
Co-Authored-By: patrick.bradley <patrick.bradley@cognition.ai>
Co-Authored-By: patrick.bradley <patrick.bradley@cognition.ai>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Devin Review

Comment thread UserFront/pom.xml Resolved
@devin-ai-integration

Copy link
Copy Markdown

GitHub Actions CI evidence (COG-1149 workflow from #329). The throwaway draft #342 was this branch plus #329's .github/workflows/userfront-ci.yml (Temurin 8, mvn -B -f UserFront/pom.xml verify). It ran green and has been closed without merging.

Job UserFront · mvn verify (109984506124):

tc.mysql:5.7.44 - Container is started (JDBC URL: jdbc:mysql://localhost:32769/onlinebanking?useSSL=false)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - in com.userFront.UserFrontApplicationTests
[INFO] BUILD SUCCESS

AdminPortal · ng build (non-blocking) also passed.

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.

1 participant