From e8563337caf8b938e4e35940cc68c236d26fe1b3 Mon Sep 17 00:00:00 2001 From: Choi Jun Ho Date: Sun, 5 May 2024 17:18:17 +0900 Subject: [PATCH] =?UTF-8?q?test(Env)=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=20yml=20=EB=B6=84=EB=A6=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- src/main/resources/application-test.yml | 46 +++++++++++++++++++ .../comunity/CommunityApplicationTests.java | 2 + .../jwt/RefreshTokenRepositoryTest.java | 2 +- 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/application-test.yml diff --git a/.gitignore b/.gitignore index f1e79dc..ca66177 100644 --- a/.gitignore +++ b/.gitignore @@ -37,5 +37,4 @@ out/ .vscode/ ### env ### -.env -application-test.yml \ No newline at end of file +.env \ No newline at end of file diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml new file mode 100644 index 0000000..9425723 --- /dev/null +++ b/src/main/resources/application-test.yml @@ -0,0 +1,46 @@ +spring: + datasource: + url: "jdbc:h2:mem:community;MODE=mysql" + username: "sa" + password: "" + driver-class-name: org.h2.Driver + + # redis 설정 + data: + redis: + host: ${REDIS_HOST} + port: ${REDIS_PORT} + + jpa: + defer-datasource-initialization: true + hibernate: + ddl-auto: create + naming: + physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy + properties: + hibernate: + dialect: org.hibernate.dialect.H2Dialect + + h2: + console: + enabled: true + path: /h2-console + + security: + oauth2: + client: + registration: + google: + client-id: ${GOOGLE_CLIENT_ID} + client-secret: ${GOOGLE_CLIENT_SECRET} + redirect-uri: ${GOOGLE_REDIRECT_URI} + +logging.level: + org.hibernate: + orm.jdbc.bind: trace + SQL: debug + +jwt: + secret: "${JWT_SECRET}" + + diff --git a/src/test/java/gdsc/comunity/CommunityApplicationTests.java b/src/test/java/gdsc/comunity/CommunityApplicationTests.java index 775da28..1b62628 100644 --- a/src/test/java/gdsc/comunity/CommunityApplicationTests.java +++ b/src/test/java/gdsc/comunity/CommunityApplicationTests.java @@ -2,8 +2,10 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; @SpringBootTest +@ActiveProfiles("test") class CommunityApplicationTests { @Test diff --git a/src/test/java/gdsc/comunity/security/jwt/RefreshTokenRepositoryTest.java b/src/test/java/gdsc/comunity/security/jwt/RefreshTokenRepositoryTest.java index dd1c30e..646f275 100644 --- a/src/test/java/gdsc/comunity/security/jwt/RefreshTokenRepositoryTest.java +++ b/src/test/java/gdsc/comunity/security/jwt/RefreshTokenRepositoryTest.java @@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional; @Transactional -@ActiveProfiles("dev") +@ActiveProfiles("test") @SpringBootTest(webEnvironment = WebEnvironment.MOCK) class RefreshTokenRepositoryTest {