DOCS/journey/troubleshooting/251110_레거시_테스트_폴더_정리.md
Claude-51124 22557e7132 docs: 오래된 트러블슈팅 아카이브 및 구조 정리
- 7-8월 초기 구축 문서 12개를 _archive/troubleshooting/2025_07-08_initial_setup/로 이동
- book/300_architecture/390_human_in_the_loop_intent_learning.md를 journey/research/intent_classification/로 이동 (개발 여정 문서)
- 빈 폴더 제거 (journey/assets/*)
2025-11-17 14:06:05 +09:00

3.6 KiB

레거시 테스트 폴더 및 스크립트 정리

날짜: 2025-11-10
작성자: Claude Code (51124 서버)
관련 폴더:

  • /home/admin/ivada_project/scripts/ (삭제)
  • /home/admin/ivada_project/test/ (정리)

문제 상황

1. scripts 폴더 (보안 리스크)

  • 11개 수동 테스트 스크립트 산재
  • Slack Bot Token, API Key 하드코딩
  • README.md에 "프로덕션 환경 실행 금지" 명시
  • 프로젝트 루트를 어지럽힘

2. test 폴더 (중복 및 레거시)

  • rb10508_micro 관련 테스트 (서비스 미사용)
  • Slack Lists 테스트 중복 (3개 → 1개로 통합 가능)
  • chromadb_upgrade/ 완료된 작업 폴더
  • Python 캐시 파일 누적

해결 방안

scripts 폴더 전체 삭제

삭제 파일 (11개):

  • add_file_to_list.py
  • check_coldmail_list.py
  • check_slack_channels.py
  • check_chroma.py
  • get_all_list_items.py
  • migrate_chromadb.py
  • search_chroma.py
  • test_file_upload_only.py
  • test_lists_api.py
  • test_lists_with_file.py
  • test_naverworks_attachment.py

이유:

  • 토큰 하드코딩 보안 리스크
  • robeing-monitor/tests/ 체계화된 테스트 관리 시작
  • 참고용 로직은 실제 서비스 코드에 반영됨

test 폴더 정리

삭제 항목 (8개):

  1. 미사용 서비스 테스트:

    • test_rb10508_micro.py (rb10508 미실행)
  2. 중복 테스트:

    • test_lists_comment.py
    • test_lists_all_fields.py
    • test_lists_with_file.py
    • 통합본: test_slack_lists_file_attachment.py 유지
  3. 임시 작업 폴더:

    • chromadb_upgrade/ (업그레이드 완료)
  4. 캐시:

    • pycache/
    • .pytest_cache/
    • .venv/

유지 파일 (10개):

  • README_TESTS.md (가이드)
  • run_all_tests.py (통합 실행)
  • test_rb8001.py (rb8001 검증)
  • test_robeing_monitor.py (robeing-monitor 검증)
  • test_skill_email.py (skill-email 검증)
  • test_uuid_consistency.py (UUID 일관성)
  • test_library_inconsistency.py (라이브러리 호환성)
  • test_json_columns.py (JSON 컬럼 처리)
  • test_db_connections.py (DB 연결)
  • test_slack_lists_file_attachment.py (Slack Lists 통합)

구현 완료

실행 명령

# scripts 폴더 삭제
rm -rf /home/admin/ivada_project/scripts

# test 폴더 정리
cd /home/admin/ivada_project/test
rm -f test_rb10508_micro.py test_lists_comment.py test_lists_all_fields.py test_lists_with_file.py
rm -rf chromadb_upgrade/ __pycache__/ .pytest_cache/ .venv/

결과

  • scripts/: 11개 파일 삭제
  • test/: 19개 → 10개 파일 (9개 제거)
  • 프로젝트 루트 정리 완료

교훈

테스트 코드 관리 원칙

  • 각 서비스 하위에 tests/ 폴더 생성 (예: robeing-monitor/tests/)
  • 프로젝트 루트에 임시 스크립트 방치 금지
  • 토큰 하드코딩 절대 금지 (.env 사용)

교훈: 테스트 코드는 서비스별로 관리하고, 임시 스크립트는 작업 완료 즉시 제거하여 프로젝트 구조 명확성 유지.

레거시 즉시 정리

  • rb10508 서비스 중단 시 관련 테스트도 즉시 제거
  • 통합 완료된 테스트는 중복본 삭제
  • 완료된 마이그레이션 폴더는 즉시 정리

교훈: 레거시 코드는 누적되면 관리 비용이 증가하므로 발견 즉시 제거.

보안 의식

  • scripts 폴더의 하드코딩된 토큰은 보안 리스크
  • Git에 푸시되지 않았더라도 서버 내 존재만으로 위험
  • 민감 정보는 .env + .gitignore 필수

교훈: 개발 편의를 위한 임시 하드코딩도 서버에 방치하지 말 것.


작성: Claude Code, 2025-11-10
검증: scripts 삭제 완료, test 폴더 19개→10개 정리 완료