test: Add H2 database for testing and update config
All checks were successful
Quality Check / Gradle Check (pull_request) Successful in 4m22s
All checks were successful
Quality Check / Gradle Check (pull_request) Successful in 4m22s
This commit is contained in:
parent
a3348fb777
commit
7fc19b5bbe
@ -9,20 +9,6 @@ jobs:
|
||||
runs-on: "ubuntu-latest"
|
||||
container:
|
||||
image: "cimg/openjdk:21.0-node"
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16.4
|
||||
env:
|
||||
POSTGRES_DB: lf8_starter_db
|
||||
POSTGRES_USER: lf8_starter
|
||||
POSTGRES_PASSWORD: secret
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd="pg_isready -U lf8_starter"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=3
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v3
|
||||
|
@ -7,6 +7,13 @@ plugins {
|
||||
group = "de.szut"
|
||||
version = "0.0.1-SNAPSHOT"
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
|
||||
// Activate the 'test' profile for Spring during tests
|
||||
systemProperty("spring.profiles.active", "test")
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
@ -35,6 +42,7 @@ dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-oauth2-client:3.3.4")
|
||||
runtimeOnly("org.postgresql:postgresql")
|
||||
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0")
|
||||
testImplementation("com.h2database:h2")
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
|
5
src/main/resources/application-test.properties
Normal file
5
src/main/resources/application-test.properties
Normal file
@ -0,0 +1,5 @@
|
||||
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
|
||||
spring.datasource.driver-class-name=org.h2.Driver
|
||||
spring.datasource.username=sa
|
||||
spring.datasource.password=
|
||||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
0
src/test/java/application-test.properties
Normal file
0
src/test/java/application-test.properties
Normal file
@ -2,6 +2,7 @@ package de.szut.lf8_starter;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@SpringBootTest
|
||||
class Lf8StarterApplicationTests {
|
||||
|
Loading…
Reference in New Issue
Block a user