Switch from MySQL to PostgreSQL and run the server tests on it#796
Merged
Conversation
Database - Replace the MySQL driver/config with PostgreSQL 18 (postgres:18-alpine) across dev, prod, Docker, env files and the local e2e runners. DB name "benchmarking", password supplied via env. - Fold the 20 incremental, MySQL-oriented Liquibase changesets into a single PostgreSQL-native initial schema (fresh install only, no data migration). Verified the consolidated schema is identical to the previous one: same columns, constraints and seed data. Tests - Run the server tests on a PostgreSQL Testcontainer (PostgreSqlTestContainer), replacing the JHipster MysqlTestContainer. - Repair the previously dormant *IT suite (it never ran in CI and could not even boot a context): provide the Liquibase changelog path and the missing properties to the test config, activate the testprod profile, authenticate MockMvc tests via JWT (WithMockJwt) to match the OAuth2 resource server, initialize the Mockito mocks/captors, and add the missing test fixtures. - Restore the JHipster ExceptionTranslator (flat application/problem+json) that had been replaced by a catch-all 500 handler; map InvalidPasswordException to 400. - Add a dedicated `integrationTest` Gradle task and run it in CI so the integration suite cannot silently rot again. All server tests green on PostgreSQL (29 unit + 195 integration). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switches the application from MySQL to PostgreSQL (fresh install on prod — no data migration) and makes the server integration tests actually run on PostgreSQL via Testcontainers.
Database
postgres:18-alpine) everywhere: dev/prod Spring config,docker-compose.yml,src/main/docker/*, env files, the Liquibase Gradle tooling and both local e2e runners. DB name isbenchmarking; the password is supplied via env (no empty/trust auth).00000000000000_initial_schema.xml). This removes the legacy MySQL property variants and thestartWith="0"identity columns (illegal on Postgres). Verified by applying both the old and the new changelogs to fresh databases and diffing: identical columns (100), constraints and seed data.Tests
PostgreSqlTestContainer, replacing the JHipsterMysqlTestContainer).*ITsuite. It had never run in CI (thetesttask excludes**/*IT*) and could not even start a context. Fixes: supply the Liquibase changelog path + missingbenchmarking.security.*properties to the test config, activate thetestprodprofile, authenticate MockMvc tests with JWT (@WithMockJwt) to match the app's OAuth2 resource-server security (@WithMockUsernever worked against it), initialize the Mockito mocks/captors that Boot 4's@MockitoBeanno longer auto-creates, and add the missing test fixtures.ExceptionTranslator(flatapplication/problem+json) that had been replaced by a catch-all handler returning empty500s;InvalidPasswordExceptionnow maps to400.integrationTestGradle task and a CI step that runs it, so the integration suite cannot silently rot again.Testing
./gradlew test -x webapp→ 29 unit tests green./gradlew integrationTest -x webapp→ 195 integration tests green (on the Postgres Testcontainer, full schema applied)./gradlew checkstyleMain -x webapp,pnpm run prettier:check,pnpm run lint→ greenNotes
testjob runs onubuntu-latest(Docker available), so the newintegrationTeststep can start the Postgres Testcontainer.🤖 Generated with Claude Code