You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, tests annotated with @DataJpaTest are transactional and roll back at the end of each test. They also use an embedded in-memory database (replacing any explicit or usually auto-configured DataSource). The @AutoConfigureTestDatabase annotation can be used to override these settings.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
test 환경에서 flyway를 사용해야 할까?
현재 yml
flyway 사용 안하도록 변경
RepositoryTest만 터진다
RepositoryTest 에서 @DataJpaTest 를 사용하기 때문이다.
embedded in-memory database 를 사용한다.
테스트 환경의 h2 database를 사용하지 않는 것이다. 사용하도록 변경하자.
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.*NONE*)
이거 추가하면 된다.
참고자료
Flyway를 사용하는 이유
H2로 SpringBoot 테스트 도중 SQL이 실행되지 않는 경우 대응법
Spring boot :: Multiple DataSource 환경에서 @DataJpaTest 이슈 정리 및 스프링 코드 분석
Beta Was this translation helpful? Give feedback.
All reactions