@@ -123,9 +123,10 @@ Run unit and integration tests:
123123./mvnw test
124124```
125125
126- Tests use ** Testcontainers** to spin up ephemeral Docker containers for external dependencies (e.g. PostgreSQL).
126+ ` SpringBootJavaRandomUserApplicationTests ` uses the ` test ` profile (` application-test.properties ` ).
127+ In CI, this file is generated by the Sonar workflow and overridden to use H2 in-memory settings.
127128
128- > ** Prerequisite for tests ** : Docker must be installed and running .
129+ > ** Note ** : Docker is only required for tests that explicitly use Testcontainers .
129130
130131---
131132
@@ -136,7 +137,10 @@ A GitHub Actions workflow is configured in:
136137``` bash
137138.github/workflows/sonar.yaml
138139```
139-
140+ You need to add your own :
141+ ``` bash
142+ src/test/resources/application-test.properties
143+ ```
140144### Workflow triggers
141145
142146- ` push ` on all branches
@@ -147,12 +151,6 @@ A GitHub Actions workflow is configured in:
147151- Java 25 setup (Temurin)
148152- Maven build + tests + SonarQube analysis:
149153
150- ``` bash
151- mvn clean verify sonar:sonar
152- ```
153-
154- The CI command waits for the Quality Gate result:
155-
156154``` bash
157155./mvnw clean verify sonar:sonar -Dsonar.qualitygate.wait=true
158156```
@@ -162,14 +160,20 @@ Before running tests, the workflow recreates:
162160``` bash
163161src/test/resources/application-test.properties
164162```
163+ spring.datasource.url=jdbc:h2:mem: testdb ;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
164+ spring.datasource.driver-class-name=org.h2.Driver
165+ spring.datasource.username=<your_username>
166+ spring.datasource.password=
167+ spring.sql.init.mode=never
165168
166- from a Base64-encoded GitHub secret.
169+ and also a github secret named APPLICATION_TEST_PROPERTIES
170+ with the content of your application-test.properties encoded in base64
167171
168172### Required GitHub Secrets
169173
170174- ` SONAR_TOKEN `
171175- ` SONAR_HOST_URL `
172- - ` APPLICATION_TEST_PROPERTIES ` (Base64-encoded ` application-test.properties ` content)
176+ - ` APPLICATION_TEST_PROPERTIES ` (` application-test.properties ` content, Base64 or raw text )
173177
174178> ` GITHUB_TOKEN ` is provided automatically by GitHub Actions.
175179
0 commit comments