diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8e3ec055..c3a9c593 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,6 +7,7 @@ spring: ddl-auto: none show-sql: true open-in-view: false + defer-datasource-initialization: false datasource: driver-class-name: org.postgresql.Driver @@ -30,10 +31,5 @@ oauth: --- spring.config.activate.on-profile: local -spring: - jpa: - hibernate: - ddl-auto: update - --- spring.config.activate.on-profile: prod diff --git a/src/test/java/com/dnd/runus/infrastructure/persistence/domain/member/MemberRepositoryImplTest.java b/src/test/java/com/dnd/runus/infrastructure/persistence/domain/member/MemberRepositoryImplTest.java index c07818c4..0fa85ffb 100644 --- a/src/test/java/com/dnd/runus/infrastructure/persistence/domain/member/MemberRepositoryImplTest.java +++ b/src/test/java/com/dnd/runus/infrastructure/persistence/domain/member/MemberRepositoryImplTest.java @@ -8,8 +8,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; @RepositoryTest class MemberRepositoryImplTest { @@ -17,10 +16,10 @@ class MemberRepositoryImplTest { private MemberRepository memberRepository; @Test - @DisplayName("findById 메서드는 Member를 반환한다.") + @DisplayName("findById 메서드는 해당하는 id의 Member가 없다면 null을 반환한다.") void findById() { Member member = memberRepository.findById(1L).orElse(null); - System.out.println(member); + assertNull(member); } @Test @@ -33,8 +32,6 @@ void save() { .mainBadge(null) .createdAt(null) .updatedAt(null) - .level(null) - .currentExp(0) .build(); Member savedMember = memberRepository.save(member); assertNotEquals(0, savedMember.memberId()); diff --git a/src/test/java/com/dnd/runus/infrastructure/persistence/jpa/member/entity/MemberEntityTest.java b/src/test/java/com/dnd/runus/infrastructure/persistence/jpa/member/entity/MemberEntityTest.java index 6069940a..3f43eef2 100644 --- a/src/test/java/com/dnd/runus/infrastructure/persistence/jpa/member/entity/MemberEntityTest.java +++ b/src/test/java/com/dnd/runus/infrastructure/persistence/jpa/member/entity/MemberEntityTest.java @@ -1,7 +1,6 @@ package com.dnd.runus.infrastructure.persistence.jpa.member.entity; import com.dnd.runus.domain.badge.Badge; -import com.dnd.runus.domain.level.Level; import com.dnd.runus.domain.member.Member; import com.dnd.runus.global.constant.BadgeType; import com.dnd.runus.global.constant.MemberRole; @@ -28,8 +27,6 @@ void setUp() { .mainBadge(badge) .createdAt(OffsetDateTime.now()) .updatedAt(OffsetDateTime.now()) - .level(new Level(1L, 100)) - .currentExp(0) .build(); } diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 1a59b834..582bdcd0 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -1,14 +1,19 @@ spring: jpa: hibernate: - ddl-auto: create + ddl-auto: none show-sql: true open-in-view: false - defer-datasource-initialization: true + defer-datasource-initialization: false datasource: driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver + flyway: + driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver + enabled: true + baseline-on-migrate: true # Baseline 생성이 필요한 상황에서 migration 작업 실행시, Baseline 생성부터 하겠다는 설정 + app: api: allow-origins: "*"