Skip to content
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

[REFACTOR] 테스트 속도 개선을 위한 병렬 실행 도입 #800

Open
jminkkk opened this issue Oct 16, 2024 · 2 comments
Open

[REFACTOR] 테스트 속도 개선을 위한 병렬 실행 도입 #800

jminkkk opened this issue Oct 16, 2024 · 2 comments
Assignees
Labels
BE 백엔드 refactor 요구사항이 바뀌지 않은 변경사항

Comments

@jminkkk
Copy link
Contributor

jminkkk commented Oct 16, 2024

📌 어떤 기능을 리팩터링 하나요?

로컬 테스트 실행 속도 개선을 위해 로컬에서 테스트를 병렬로 실행하도록 한다.

AS-IS

약 300개 이상 테스트 -> 1분 내외

TO-BE

⏳ 예상 소요 시간 (예상 해결 날짜)

1일

1일 0시간 소요 (00/00 00:00)

🔍 참고할만한 자료(선택)

@jminkkk jminkkk added the refactor 요구사항이 바뀌지 않은 변경사항 label Oct 16, 2024
@jminkkk
Copy link
Contributor Author

jminkkk commented Oct 16, 2024

1. junit 설정

junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=concurrent
junit.jupiter.execution.parallel.mode.classes.default=concurrent
junit.jupiter.execution.parallel.config.strategy=dynamic
junit.jupiter.execution.parallel.config.dynamic.factor=1

현재 로컬 테스트 실행시 , 로컬의 mysql 도커를 사용하여 실행되고 있음
병렬로 실행 시, 하나의 DB에 동시에 접속하여 DataIntegrityViolationException, JpaSystemException, LockAcquisitionException 등의 에러 발생 (302 tests completed, 105 failed)

h2 같은 인메모리 디비를 사용했을 경우, 각 테스트에서 실행 시 여러 개의 디비를(ex. 테스트당 하나의 디비 등) 띄우도록 설정을 할 수 있지만
이미 띄어져있는 도커를 가져다가 사용하는 경우는 스프링단에서 불가능

즉 테스트 간 격리가 가능하지 않음

@jminkkk
Copy link
Contributor Author

jminkkk commented Oct 16, 2024

2. 테스트 컨테이너

테스트 컨테이너 라이브러리를 사용해서 몇 개의 컨테이너를 �띄우고 병렬 실행하면 속도가 줄어들지 않을까? 시도

image

컨테이너 띄우는 시간 떄문에 더 든다ㅠ

@Jaymyong66 Jaymyong66 added the BE 백엔드 label Oct 20, 2024
@Jaymyong66 Jaymyong66 added this to the 6차 스프린트 🦴 milestone Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 refactor 요구사항이 바뀌지 않은 변경사항
Projects
Status: Todo
Development

No branches or pull requests

2 participants