Skip to content

Commit 77d2b70

Browse files
committed
fix(use_h2_sonarqube): add h2 librairy to easily test repository on unit test and sonar
1 parent faf4647 commit 77d2b70

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ build/
3131

3232
### VS Code ###
3333
.vscode/
34+
35+
# Test configuration generated in CI
36+
src/test/resources/application-test.properties

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,28 @@ A GitHub Actions workflow is configured in:
151151
mvn clean verify sonar:sonar
152152
```
153153

154+
The CI command waits for the Quality Gate result:
155+
156+
```bash
157+
./mvnw clean verify sonar:sonar -Dsonar.qualitygate.wait=true
158+
```
159+
160+
Before running tests, the workflow recreates:
161+
162+
```bash
163+
src/test/resources/application-test.properties
164+
```
165+
166+
from a Base64-encoded GitHub secret.
167+
168+
### Required GitHub Secrets
169+
170+
- `SONAR_TOKEN`
171+
- `SONAR_HOST_URL`
172+
- `APPLICATION_TEST_PROPERTIES` (Base64-encoded `application-test.properties` content)
173+
174+
> `GITHUB_TOKEN` is provided automatically by GitHub Actions.
175+
154176
### Generate the JaCoCo coverage report locally
155177

156178
Run:

src/test/java/com/xpeho/spring_boot_java_random_user/SpringBootJavaRandomUserApplicationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import org.junit.jupiter.api.Test;
44
import org.springframework.boot.test.context.SpringBootTest;
5-
import org.springframework.context.annotation.Import;
5+
import org.springframework.test.context.ActiveProfiles;
66

77
@SpringBootTest
8+
@ActiveProfiles("test")
89
class SpringBootJavaRandomUserApplicationTests {
910

1011
@Test

0 commit comments

Comments
 (0)