Skip to content

Conversation

@asn6878
Copy link
Member

@asn6878 asn6878 commented Jan 21, 2025

📋 작업 내용

@testcontainers/redis 라이브러리 추가

레디스 동작을 컨테이너 위에서 돌리기 위해 필요한 라이브러리를 dev dependency 로 설치하였습니다.

Redis 동작 Testcontainers 적용

#22 작업과 동일하게, Redis Mock을 사용하지 않고 실제 Redis 컨테이너를 사용하도록 수정하였습니다.
이에따라 global-setup 파일명을 변경하고, MySQL, Redis 두가지 컨테이너를 세팅하는 파일로 변경하였습니다.

또한, Redis.disconnect() 를 마지막에 수행해주지 않을 시 테스트가 정상적으로 종료되지 않아 CI 스크립트가 종료되지 않는 문제가 발생했습니다. afterAll()에서 별도로 disconnect()` 처리를 하도록 하였습니다.

await이 붙어있지 않은 redis 동작들 await 처리

테스트 코드 실행 후 코드를 점검 하자 몇가지 redis 동작들이 await처리가 되어있지 않음을 확인하여 await 키워드를 추가하였습니다.

테스트 suites들의 given절 오류 수정

로그인 처리를 수행하기 위해 redis에 sid 정보를 저장할때, set 메서드가 아닌 sadd 메서드를 사용하는 코드들이 있었습니다. 이 부분들을 set으로 처리하도록 수정하였습니다.

@asn6878 asn6878 added the ✅ Test 테스트 관련 (storybook, vitest, jest 등) label Jan 21, 2025
@asn6878 asn6878 self-assigned this Jan 21, 2025
@asn6878 asn6878 added the 🔨 Refactor 리팩토링 (구조 변경) label Jan 21, 2025
@asn6878 asn6878 changed the title Test/test redis migrate ♻️ refactor: redis Testconatiners 적용 Jan 21, 2025
@asn6878 asn6878 marked this pull request as draft January 21, 2025 07:10
@asn6878 asn6878 requested review from CodeVac513 and Jo-Minseok and removed request for CodeVac513 January 21, 2025 09:32
@asn6878 asn6878 marked this pull request as ready for review January 21, 2025 09:33
Copy link
Member

@Jo-Minseok Jo-Minseok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다! 혹여나 이미지 버전 선택할 수 있다면
MySQL은 8.0.39
Redis는 6.0.16-alpine으로 변경 가능하다면 부탁드립니다

Copy link
Collaborator

@CodeVac513 CodeVac513 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 수고많으셨습니다.

@asn6878 asn6878 merged commit 3e2ac68 into main Jan 28, 2025
2 checks passed
@asn6878 asn6878 deleted the test/test-redis-migrate branch January 28, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 리팩토링 (구조 변경) ✅ Test 테스트 관련 (storybook, vitest, jest 등)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants