Skip to content

Commit dc73d41

Browse files
committed
[TEST] 테스트 환경 설정 (H2, test profile)
1 parent 6e9a074 commit dc73d41

3 files changed

Lines changed: 46 additions & 3 deletions

File tree

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ dependencies {
6464
// Redis
6565
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
6666

67+
// 테스트용 H2 인메모리 DB
68+
testImplementation 'com.h2database:h2'
6769
}
6870

6971
test {
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
package com.example.be;
22

33
import org.junit.jupiter.api.Test;
4-
import org.springframework.boot.test.context.SpringBootTest;
54

6-
@SpringBootTest
5+
/**
6+
* 기본 애플리케이션 테스트
7+
*
8+
* 참고: @SpringBootTest는 전체 컨텍스트를 로드하므로
9+
* DB, Redis 등 외부 의존성이 필요합니다.
10+
* Unit Test 위주로 테스트하는 것을 권장합니다.
11+
*/
712
class BeApplicationTests {
813

914
@Test
10-
void contextLoads() {
15+
void applicationStartsSuccessfully() {
16+
// Unit Test는 외부 의존성 없이 실행 가능
17+
// Service 테스트에서 비즈니스 로직 검증
1118
}
1219

1320
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
spring:
2+
datasource:
3+
url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=MySQL;NON_KEYWORDS=USER
4+
driver-class-name: org.h2.Driver
5+
username: sa
6+
password:
7+
8+
jpa:
9+
hibernate:
10+
ddl-auto: create-drop
11+
show-sql: true
12+
properties:
13+
hibernate:
14+
format_sql: true
15+
globally_quoted_identifiers: true
16+
17+
# Redis 비활성화 (테스트에서는 Mock 사용)
18+
data:
19+
redis:
20+
host: localhost
21+
port: 6379
22+
23+
jwt:
24+
secret: test-secret-key-for-testing-purposes-only-1234567890-abcdefghij
25+
access-token:
26+
expiration-time: 3600000
27+
refresh-token:
28+
expiration-time: 604800000
29+
30+
livekit:
31+
api:
32+
host: http://localhost:7880
33+
key: test-key
34+
secret: test-secret

0 commit comments

Comments
 (0)