Skip to content

Commit 199e749

Browse files
committed
Test: 테스트 환경변수 설정 및 프로파일
--amend
1 parent d279e23 commit 199e749

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/main/resources/application-dev.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ springdoc:
2424

2525
logging:
2626
level:
27-
org.hibernate.orm.jdbc.bind: trace
27+
org.hibernate.orm.jdbc.bind: trace
28+
29+
jwt:
30+
secret: ${JWT_SECRET:test-jwt-secret-key-12345678901234567890} # 운영 시에는 반드시 환경 변수로 설정할 것
31+
access-token-expiration: ${JWT_ACCESS_TOKEN_EXPIRATION:1800} # 30분 (초 단위)
32+
refresh-token-expiration: ${JWT_REFRESH_TOKEN_EXPIRATION:604800} # 7일 (초 단위)

src/main/resources/application-test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ spring:
33
url: jdbc:h2:mem:db_test;MODE=MySQL
44
driver-class-name: org.h2.Driver
55
username: sa
6-
password:
6+
password:
7+
8+
jwt:
9+
secret: test-jwt-secret-key-12345678901234567890
10+
access-token-expiration: ${JWT_ACCESS_TOKEN_EXPIRATION:1800} # 30분 (초 단위)
11+
refresh-token-expiration: ${JWT_REFRESH_TOKEN_EXPIRATION:604800} # 7일 (초 단위)

src/test/java/com/back/JwtSecurityIntegrationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
import org.springframework.beans.factory.annotation.Autowired;
77
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
88
import org.springframework.boot.test.context.SpringBootTest;
9+
import org.springframework.test.context.ActiveProfiles;
910
import org.springframework.test.web.servlet.MockMvc;
1011

1112
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
1213
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
1314

1415
@SpringBootTest
1516
@AutoConfigureMockMvc
17+
@ActiveProfiles("test")
1618
class JwtSecurityIntegrationTest {
1719

1820
@Autowired

0 commit comments

Comments
 (0)