-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
테스트 환경 설정 및 리팩터링 #261
테스트 환경 설정 및 리팩터링 #261
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
승인합니다.
createdAt은 트랜잭션이 커밋될 때 동시에 들어가면, 같은 시간으로 들어가서 틀어질 수도 있을 것 같긴 하네요.
JpaTest는 저도 굳이 나눌 필요 없을 것 같다고 생각합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question : 이거 어떻게 사용하나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 IntelliJ 도커 탭으로 실행하고, 제 컴퓨터 환경(윈도우) 기준 스프링은 로컬에 비해 컨테이너가 많이 느려서 로컬로 실행하고 있어요.
커맨드 쓰신다면 아마 아래와 같이 하면 될거예요.
docker compose -f compose.dev.yml up
c659754
to
3b9b84e
Compare
3b9b84e
to
e525e9c
Compare
변경 내용
개발 환경
Dockerfile
에dev
및prod
모드 설정 (기본:prod
)dev
모드compose.dev.yml
파일 추가테스트 환경
IntegrationTestSupport
상속받도록 수정@Transactional
어노테이션을 메서드에서 테스트 클래스로 이동DBCleaner.execute
는 테스트 클래스 단위로 설정되므로 일관성 있도록DBCleanUp
->DBCleaner
로 이름 변경 및 하드코딩 리팩터링 (Spring 및 Hibernate 내에서 Cleanup보다 Cleaner 명칭을 더 선호함)application-test.yaml
파일에서 불필요한 속성 제거기타
application-dev.yaml
파일은 변경되지 않아 기존 방식대로 실행 가능@Transactional
어노테이션이 없는 테스트 클래스에 구현해야 함 (OotdServiceMultiThreadTest
등)createdAt
으로 정렬하는 테스트의 경우 일정 확률로 실패함@DataJpaTest
를 사용하도록 변경할 지?@SpringBootTest
를 사용해도 테스트 시간 10초로 충분히 빠름