-
Notifications
You must be signed in to change notification settings - Fork 0
Improve test architecture and add environment configuration #48
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
Conversation
- Replace per-request service creation with dependency injection - Add .env support for UPLOAD_DIR configuration - Implement sequential test execution to prevent race conditions - Auto-generate test problem IDs using rand
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.
Pull Request Overview
This PR improves the test architecture and adds environment configuration by implementing proper test isolation with automatic cleanup, introducing configurable file upload paths, and restructuring the codebase to separate business logic from handlers.
- Uses
tempfilecrate for automatic test directory cleanup upon test completion - Adds environment variable configuration for upload directory paths via
.envfile - Refactors file management architecture by separating storage layer (
LocalFileStorage), service layer (FileService), and handlers
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/file_manager/handlers.rs | Replaces manual cleanup with tempfile-based test isolation and adds serial test execution |
| src/lib.rs | Adds environment configuration loading and dependency injection for file service |
| src/file_manager/storage.rs | New storage abstraction layer for file operations |
| src/file_manager/service.rs | New service layer containing business logic for file operations |
| src/file_manager/mod.rs | Exports new storage and service modules |
| src/file_manager/handlers.rs | Refactored to use dependency injection and simplified error handling |
| src/file_manager/git.rs | Updated to use configurable base paths instead of hardcoded directory |
| Cargo.toml | Adds dependencies for environment configuration, random number generation, and test utilities |
| .env | Adds upload directory configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
random으로 problem_id 생성하는 건 테스트간 단순 충돌 방지 목적인가요? |
생각해보니 이제 테스트마다 저장되는 디렉터리가 달라져서 굳이 이악물고 rand crate 사용해서 랜덤으로 만들 필요도 없는것 같네요👍 고냥 problem_id = 0으로 변경하겠습니다 |
|
이 PR은 일단 merge하고 request change 있으면 40-revision 에서 main 갈 때 반영하겠습니다! |
|
dotenv 말고 다른 걸 사용해야 겠군요 |
구현한 기능
.env에 파일 업로드할 경로 설정src/file_manager/handlers.rs에 있던 비즈니스 로직을src/file_manager/storage.rs와src/file_manager/service.rs를 만들어 분리#47 TODO에서
test와 production 환경 분리작업과tempfile crate 사용하여 테스트 보완작업을 하였습니다.part of #40
TODO