Skip to content

Commit

Permalink
unit test db using h2 testdb
Browse files Browse the repository at this point in the history
  • Loading branch information
linxiaoxin committed Sep 29, 2024
1 parent 3b72b44 commit fcc413d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies {
runtimeOnly 'org.flywaydb:flyway-database-postgresql'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'com.h2database:h2:2.3.230' // Replace with the latest version
testImplementation 'org.junit.jupiter:junit-jupiter-api'
}

Expand Down
54 changes: 54 additions & 0 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
spring:
application:
name: statistics_ms

# JPA configuration
jpa.:
hibernate:
ddl-auto: none
properties:
hibernate:
format_sql: true
show-sql: false

datasource:
url: jdbc:h2:mem:testdb
driverClassName: org.h2.Driver
username: sa
password: password
# driver-class-name: org.postgresql.Driver
h2:
console:
enabled: true

flyway:
enabled: true
baselineOnMigrate: true
locations: classpath:db/migration
url: ${spring.datasource.url}
schemas: qms_report
user: ${spring.datasource.username}
password: ${spring.datasource.password}

management:
endpoints:
web:
exposure:
include: health
base-path: /v1
path-mapping:
health: /stats/actuator
endpoint:
health:
show-details: never
enabled: true
health:
mail:
enabled: false

server:
port: 80

logging:
level:
javax.net.ssl: DEBUG

0 comments on commit fcc413d

Please sign in to comment.