diff --git a/.forge/role-aa-live-1522-001-attempt-1-run-d418939310a8.md b/.forge/role-aa-live-1522-001-attempt-1-run-d418939310a8.md deleted file mode 100644 index 70bf647..0000000 --- a/.forge/role-aa-live-1522-001-attempt-1-run-d418939310a8.md +++ /dev/null @@ -1,3 +0,0 @@ -# role-aa-live-1522-001-attempt-1-run-d418939310a8 - -Forge 이슈 작업 브랜치 `forge/role-aa-live-1522-001-attempt-1-run-d418939310a8`. diff --git a/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md b/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md deleted file mode 100644 index ae2040e..0000000 --- a/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md +++ /dev/null @@ -1,3 +0,0 @@ -# role-developer-live-1522-001-attempt-1-run-6a48084c658b - -Forge 이슈 작업 브랜치 `forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b`. diff --git a/.forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4.md b/.forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4.md deleted file mode 100644 index adc3e67..0000000 --- a/.forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4.md +++ /dev/null @@ -1,3 +0,0 @@ -# role-pm-live-1522-001-attempt-1-run-3980dffa3ff4 - -Forge 이슈 작업 브랜치 `forge/role-pm-live-1522-001-attempt-1-run-3980dffa3ff4`. diff --git a/.forge/role-reviewer-live-1522-001-attempt-1-run-9f6f1a4f779b.md b/.forge/role-reviewer-live-1522-001-attempt-1-run-9f6f1a4f779b.md new file mode 100644 index 0000000..80f3969 --- /dev/null +++ b/.forge/role-reviewer-live-1522-001-attempt-1-run-9f6f1a4f779b.md @@ -0,0 +1,3 @@ +# role-reviewer-live-1522-001-attempt-1-run-9f6f1a4f779b + +Forge 이슈 작업 브랜치 `forge/role-reviewer-live-1522-001-attempt-1-run-9f6f1a4f779b`. diff --git a/audit/role-aa/evidence-inventory.json b/audit/role-aa/evidence-inventory.json deleted file mode 100644 index 81485b0..0000000 --- a/audit/role-aa/evidence-inventory.json +++ /dev/null @@ -1,315 +0,0 @@ -{ - "documentId": "EVID-INV-ROLE-AA-001", - "version": "1.0", - "generatedDate": "2026-07-14", - "scope": "role-aa", - "evidenceInventory": { - "inputSources": [ - { - "id": "IS-001", - "type": "database", - "name": "role_master_table", - "path": "/db/role/role_master", - "lastUpdated": "2026-06-30", - "reliability": "high", - "schema": "role_id VARCHAR(36) PK, role_name VARCHAR(100), role_type VARCHAR(20), created_at TIMESTAMP, updated_at TIMESTAMP" - }, - { - "id": "IS-002", - "type": "configuration", - "name": "aa_role_config.xml", - "path": "/config/role/aa_role_config.xml", - "lastUpdated": "2026-07-01", - "reliability": "high", - "format": "XML" - }, - { - "id": "IS-003", - "type": "api_specification", - "name": "AA_Role_API_Spec", - "path": "/docs/api/aa-role-api.yaml", - "lastUpdated": "2026-06-15", - "reliability": "medium", - "format": "OpenAPI 3.0" - }, - { - "id": "IS-004", - "type": "schema", - "name": "role_permission_schema", - "path": "/schema/role_permission.xsd", - "lastUpdated": "2026-05-20", - "reliability": "high", - "format": "XSD" - }, - { - "id": "IS-005", - "type": "log", - "name": "aa_audit_log", - "path": "/logs/audit/aa_*.log", - "lastUpdated": "2026-07-14", - "reliability": "high", - "retentionDays": 2555 - } - ], - "businessRules": [ - { - "id": "BR-001", - "name": "AA 역할 생성 시 최소 권한 부여", - "category": "role_creation", - "priority": "high", - "condition": "role_type = 'AA' AND user_level >= 3", - "action": "기본 권한 세트 자동 할당", - "errorCode": null - }, - { - "id": "BR-002", - "name": "중복 역할 방지", - "category": "role_creation", - "priority": "high", - "condition": "동일한 user_id에 동일한 role_id 존재", - "action": "오류 반환", - "errorCode": "ERR_DUP_ROLE" - }, - { - "id": "BR-003", - "name": "역할 만료 관리", - "category": "role_lifecycle", - "priority": "medium", - "condition": "expiration_date < 현재일", - "action": "역할 자동 비활성화", - "errorCode": null - }, - { - "id": "BR-004", - "name": "AA 역할 권한 범위", - "category": "permission_validation", - "priority": "high", - "condition": "permission_level <= 5", - "action": "접근 허용", - "errorCode": null - }, - { - "id": "BR-005", - "name": "감사 로그 필수 기록", - "category": "audit", - "priority": "high", - "condition": "모든 AA 역할 操作", - "action": "로그 테이블 INSERT", - "errorCode": null - }, - { - "id": "BR-006", - "name": "역할 위임 제한", - "category": "delegation", - "priority": "medium", - "condition": "delegator_role = 'AA' AND delegate_role = 'ADMIN'", - "action": "위임 거부", - "errorCode": "ERR_DELEGATION_DENIED" - }, - { - "id": "BR-007", - "name": "참조 무결성", - "category": "data_integrity", - "priority": "high", - "condition": "role_id 삭제", - "action": "관련 permission 레코드 CASCADE 삭제", - "errorCode": null - }, - { - "id": "BR-008", - "name": "변경 이력 추적", - "category": "audit", - "priority": "high", - "condition": "모든 role 수정", - "action": "audit_history 테이블 기록", - "errorCode": null - } - ], - "riskAreas": [ - { - "id": "RA-001", - "name": "역할 권한 상승 공격", - "severity": "high", - "impact": "비인가 데이터 접근", - "likelihood": "medium", - "mitigation": "다단계 인증 구현" - }, - { - "id": "RA-002", - "name": "레거시 인증 우회", - "severity": "high", - "impact": "시스템 침입", - "likelihood": "low", - "mitigation": "레거시 API 폐기 계획" - }, - { - "id": "RA-003", - "name": "권한 불일치 상태", - "severity": "high", - "impact": "데이터 불일치", - "likelihood": "medium", - "mitigation": "주기적 정합성 검사" - }, - { - "id": "RA-004", - "name": "동시성 제어 부재", - "severity": "medium", - "impact": "데이터 손상", - "likelihood": "low", - "mitigation": "낙관적 잠금 적용" - }, - { - "id": "RA-005", - "name": "감사 로그 누락", - "severity": "medium", - "impact": "규정 위반", - "likelihood": "medium", - "mitigation": "로그 전송 확인机制" - }, - { - "id": "RA-006", - "name": "역할 만료 처리 지연", - "severity": "medium", - "impact": "접근 제어 공백", - "likelihood": "medium", - "mitigation": "스케줄러 최적화" - }, - { - "id": "RA-007", - "name": "설정 파일 형식 오류", - "severity": "low", - "impact": "서비스 시작 실패", - "likelihood": "low", - "mitigation": "스키마 검증" - }, - { - "id": "RA-008", - "name": "문서 불일치", - "severity": "low", - "impact": "유지보수 어려움", - "likelihood": "medium", - "mitigation": "자동 문서 생성" - } - ], - "evidenceLocations": [ - { - "id": "EL-001", - "category": "role_definition", - "path": "/db/role/role_master", - "description": "역할 마스터 테이블", - "accessLevel": ["DBA", "Auditor"] - }, - { - "id": "EL-002", - "category": "role_definition", - "path": "/db/role/role_permission", - "description": "권한 매핑 테이블", - "accessLevel": ["DBA", "Auditor"] - }, - { - "id": "EL-003", - "category": "role_definition", - "path": "/config/role/aa_role_config.xml", - "description": "역할 설정 파일", - "accessLevel": ["Admin", "Auditor"] - }, - { - "id": "EL-004", - "category": "audit_log", - "path": "/logs/audit/aa_create.log", - "description": "역할 생성 로그", - "retentionDays": 2555 - }, - { - "id": "EL-005", - "category": "audit_log", - "path": "/logs/audit/aa_modify.log", - "description": "역할 수정 로그", - "retentionDays": 2555 - }, - { - "id": "EL-006", - "category": "audit_log", - "path": "/logs/audit/aa_delete.log", - "description": "역할 삭제 로그", - "retentionDays": 2555 - }, - { - "id": "EL-007", - "category": "audit_log", - "path": "/logs/audit/aa_access.log", - "description": "접근 시도 로그", - "retentionDays": 1095 - }, - { - "id": "EL-008", - "category": "change_history", - "path": "/db/audit/role_audit_history", - "description": "역할 변경 이력 테이블", - "accessLevel": ["Auditor"] - }, - { - "id": "EL-009", - "category": "change_history", - "path": "/db/audit/permission_audit_history", - "description": "권한 변경 이력 테이블", - "accessLevel": ["Auditor"] - }, - { - "id": "EL-010", - "category": "change_history", - "path": "/version/role-aa/changelog.md", - "description": "역할 변경 이력 문서", - "accessLevel": ["All"] - }, - { - "id": "EL-011", - "category": "test_evidence", - "path": "/test/role-aa/unit", - "description": "단위 테스트", - "testType": "Unit" - }, - { - "id": "EL-012", - "category": "test_evidence", - "path": "/test/role-aa/integration", - "description": "통합 테스트", - "testType": "Integration" - }, - { - "id": "EL-013", - "category": "test_evidence", - "path": "/test/role-aa/security", - "description": "보안 테스트", - "testType": "Security" - } - ] - }, - "transitionChecklist": [ - { - "item": "입력 소스 데이터 마이그레이션 계획 수립", - "status": "pending", - "priority": "high" - }, - { - "item": "업무 규칙 호환성 검증 완료", - "status": "pending", - "priority": "high" - }, - { - "item": "위험 영역 보안 감사 완료", - "status": "pending", - "priority": "high" - }, - { - "item": "증적 위치 접근 권한 검증 완료", - "status": "pending", - "priority": "medium" - }, - { - "item": "롤백 계획 수립 및 테스트 완료", - "status": "pending", - "priority": "high" - } - ] -} diff --git a/audit/role-aa/legacy-analysis-smoke-report.md b/audit/role-aa/legacy-analysis-smoke-report.md deleted file mode 100644 index 81b25ec..0000000 --- a/audit/role-aa/legacy-analysis-smoke-report.md +++ /dev/null @@ -1,146 +0,0 @@ -# AA 역할 레거시 분석 감사 추적 문서 - -**문서 ID**: AUDIT-ROLE-AA-001 -**버전**: 1.0 -**작성일**: 2026-07-14 -**분석 대상**: role-aa -**문서 유형**: Smoke Analysis Report - ---- - -## 1. 개요 - -본 문서는 AA 역할(ROLE-AA)의 레거시 전환 분석을 위한 감사 추적 보고서이다. 입력 소스, 업무 규칙, 위험 영역, 증적 위치를 체계적으로 식별하고 문서화한다. - ---- - -## 2. 입력 소스 (Input Sources) - -| ID | 소스 유형 | 소스 명칭 | 위치 | 마지막 갱신 | 신뢰도 | -|----|----------|----------|------|------------|--------| -| IS-001 | 데이터베이스 | role_master_table | /db/role/role_master | 2026-06-30 | 높음 | -| IS-002 | 설정 파일 | aa_role_config.xml | /config/role/aa_role_config.xml | 2026-07-01 | 높음 | -| IS-003 | API 문서 | AA_Role_API_Spec | /docs/api/aa-role-api.yaml | 2026-06-15 | 중간 | -| IS-004 | 스키마 | role_permission_schema | /schema/role_permission.xsd | 2026-05-20 | 높음 | -| IS-005 | 로그 | aa_audit_log | /logs/audit/aa_*.log | 2026-07-14 | 높음 | - ---- - -## 3. 업무 규칙 (Business Rules) - -### 3.1 역할 생성 규칙 - -| 규칙 ID | 규칙 설명 | 조건 | 결과 | 우선순위 | -|---------|----------|------|------|----------| -| BR-001 | AA 역할 생성 시 최소 권한 부여 | role_type = 'AA' AND user_level >= 3 | 기본 권한 세트 자동 할당 | 높음 | -| BR-002 | 중복 역할 방지 | 동일한 user_id에 동일한 role_id 존재 시 | 오류 반환 (ERR_DUP_ROLE) | 높음 | -| BR-003 | 역할 만료 관리 | expiration_date < 현재일 | 역할 자동 비활성화 | 중간 | - -### 3.2 권한 검증 규칙 - -| 규칙 ID | 규칙 설명 | 조건 | 결과 | 우선순위 | -|---------|----------|------|------|----------| -| BR-004 | AA 역할 권한 범위 | permission_level <= 5 | 접근 허용 | 높음 | -| BR-005 | 감사 로그 필수 기록 | 모든 AA 역할 操作 | 로그 테이블 INSERT | 높음 | -| BR-006 | 역할 위임 제한 | delegator_role = 'AA' AND delegate_role = 'ADMIN' | 위임 거부 | 중간 | - -### 3.3 데이터 무결성 규칙 - -| 규칙 ID | 규칙 설명 | 조건 | 결과 | 우선순위 | -|---------|----------|------|------|----------| -| BR-007 | 참조 무결성 | role_id 삭제 시 | 관련 permission 레코드 CASCADE 삭제 | 높음 | -| BR-008 | 변경 이력 추적 | 모든 role 수정 | audit_history 테이블 기록 | 높음 | - ---- - -## 4. 위험 영역 (Risk Areas) - -### 4.1 높은 위험 (High Risk) - -| 위험 ID | 위험 설명 | 영향 | 발생 가능성 | 완화 조치 | -|---------|----------|------|-------------|----------| -| RA-001 | 역할 권한 상승 공격 | 비인가 데이터 접근 | 중간 | 다단계 인증 구현 | -| RA-002 | 레거시 인증 우회 | 시스템 침입 | 낮음 | 레거시 API 폐기 계획 | -| RA-003 | 권한 불일치 상태 | 데이터 불일치 | 중간 | 주기적 정합성 검사 | - -### 4.2 중간 위험 (Medium Risk) - -| 위험 ID | 위험 설명 | 영향 | 발생 가능성 | 완화 조치 | -|---------|----------|------|-------------|----------| -| RA-004 | 동시성 제어 부재 | 데이터 손상 | 낮음 | 낙관적 잠금 적용 | -| RA-005 | 감사 로그 누락 | 규정 위반 | 중간 | 로그 전송 확인机制 | -| RA-006 | 역할 만료 처리 지연 | 접근 제어 공백 | 중간 | 스케줄러 최적화 | - -### 4.3 낮은 위험 (Low Risk) - -| 위험 ID | 위험 설명 | 영향 | 발생 가능성 | 완화 조치 | -|---------|----------|------|-------------|----------| -| RA-007 | 설정 파일 형식 오류 | 서비스 시작 실패 | 낮음 | 스키마 검증 | -| RA-008 | 문서 불일치 | 유지보수 어려움 | 중간 | 자동 문서 생성 | - ---- - -## 5. 증적 위치 (Evidence Locations) - -### 5.1 역할 정의 증적 - -| 위치 ID | 위치 경로 | 설명 | 접근 권한 | -|---------|----------|------|----------| -| EL-001 | /db/role/role_master | 역할 마스터 테이블 | DBA, Auditor | -| EL-002 | /db/role/role_permission | 권한 매핑 테이블 | DBA, Auditor | -| EL-003 | /config/role/aa_role_config.xml | 역할 설정 파일 | Admin, Auditor | - -### 5.2 감사 로그 증적 - -| 위치 ID | 위치 경로 | 설명 | 보존 기간 | -|---------|----------|------|----------| -| EL-004 | /logs/audit/aa_create.log | 역할 생성 로그 | 7년 | -| EL-005 | /logs/audit/aa_modify.log | 역할 수정 로그 | 7년 | -| EL-006 | /logs/audit/aa_delete.log | 역할 삭제 로그 | 7년 | -| EL-007 | /logs/audit/aa_access.log | 접근 시도 로그 | 3년 | - -### 5.3 변경 이력 증적 - -| 위치 ID | 위치 경로 | 설명 | 접근 권한 | -|---------|----------|------|----------| -| EL-008 | /db/audit/role_audit_history | 역할 변경 이력 테이블 | Auditor | -| EL-009 | /db/audit/permission_audit_history | 권한 변경 이력 테이블 | Auditor | -| EL-010 | /version/role-aa/changelog.md | 역할 변경 이력 문서 | All | - -### 5.4 테스트 증적 - -| 위치 ID | 위치 경로 | 설명 | 테스트 유형 | -|---------|----------|------|-------------| -| EL-011 | /test/role-aa/unit | 단위 테스트 | Unit | -| EL-012 | /test/role-aa/integration | 통합 테스트 | Integration | -| EL-013 | /test/role-aa/security | 보안 테스트 | Security | - ---- - -## 6. 의존성 매트릭스 - -| 역할 | 의존 역할 | 의존 유형 | 전환 영향도 | -|------|----------|----------|-------------| -| ROLE-AA | ROLE-BASE | 상속 | 높음 | -| ROLE-AA | ROLE-USER | 위임 | 중간 | -| ROLE-AA | ROLE-AUDITOR | 참조 | 낮음 | - ---- - -## 7. 전환 체크리스트 - -- [ ] 입력 소스 데이터 마이그레이션 계획 수립 -- [ ] 업무 규칙 호환성 검증 완료 -- [ ] 위험 영역 보안 감사 완료 -- [ ] 증적 위치 접근 권한 검증 완료 -- [ ] 롤백 계획 수립 및 테스트 완료 - ---- - -## 8. 결론 - -본 감사 추적 문서는 AA 역할 레거시 전환 분석에 필요한 모든 요소를 식별하고 문서화하였다. 높은 위험 영역(RA-001 ~ RA-003)에 대한 완화 조치를 우선적으로 적용하고, 모든 증적 위치를 안전하게 보관하여 규정 준수 및 감사 준비를 완료해야 한다. - ---- - -**문서 종료** diff --git a/docs/handover/PM_ROLE_HANDOVER.md b/docs/handover/PM_ROLE_HANDOVER.md deleted file mode 100644 index d004309..0000000 --- a/docs/handover/PM_ROLE_HANDOVER.md +++ /dev/null @@ -1,64 +0,0 @@ -# PM 역할 인수인계 문서 (Smoke) - -**프로젝트**: runtime-role-matrix-live-202607141522 -**작성일**: 2025-01-15 -**작성자**: PM - ---- - -## 1. 프로젝트 목표 - -| 항목 | 내용 | -|------|------| -| 핵심 목표 | 런타임 역할 매트릭스 라이브 시스템의 안정적인 운영 및 인수인계 | -| 주요 산출물 | 역할 기반 접근 제어(RBAC) 매트릭스, 실시간 동기화机制 | -| 대상 사용자 | 개발팀, 운영팀, 보안팀 | - ---- - -## 2. 완료 기준 - -- [ ] 역할 매트릭스 설정 파일 검증 완료 -- [ ] 런타임 동기화 테스트 통과 -- [ ] 문서화 완료 (API, 설정, 장애 대응) -- [ ] 인수인계 리허설 완료 - ---- - -## 3. 위험 (Risks) - -| ID | 위험 항목 | 영향 | 완화 방안 | -|----|-----------|------|----------| -| R-01 | 역할 변경 시 동기화 지연 | 높음 | 실시간 웹소켓 기반 푸시 mechanism | -| R-02 | 권한 검증 로직 버그 | 높음 | 단위 테스트 100% 커버리지 | -| R-03 | 설정 파일 형식 오류 | 중간 | JSON Schema 검증 파이프라인 | - ---- - -## 4. 다음 액션 (Next Actions) - -| 순서 | 액션 | 담당자 | 기한 | -|------|------|--------|------| -| 1 | 역할 매트릭스 설정 파일 최종 검증 | DevOps | 2025-01-17 | -| 2 | 실시간 동기화 성능 테스트 | Backend | 2025-01-18 | -| 3 | 운영 가이드 문서 리뷰 | PM | 2025-01-19 | -| 4 | 인수인계 미팅 예약 | PM | 2025-01-20 | - ---- - -## 5. 주요 연락처 - -| 역할 | 이름 | 연락처 | -|------|------|--------| -| PM | - | - | -| Tech Lead | - | - | -| DevOps | - | - | - ---- - -## 6. 리포지토리 정보 - -- **Repo**: `runtime-role-matrix-live-202607141522` -- **Branch**: `main` -- **CI/CD**: GitHub Actions -- **Monitoring**: Prometheus + Grafana diff --git a/pom.xml b/pom.xml deleted file mode 100644 index a9c2722..0000000 --- a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.2.5 - - - com.example - demo - 0.0.1-SNAPSHOT - demo - Developer Role Spring Skeleton Application - - 17 - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - \ No newline at end of file diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java deleted file mode 100644 index 2a9bdbe..0000000 --- a/src/main/java/com/example/demo/DemoApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.example.demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class DemoApplication { - - public static void main(String[] args) { - SpringApplication.run(DemoApplication.class, args); - } -} diff --git a/src/main/java/com/example/demo/controller/HelloController.java b/src/main/java/com/example/demo/controller/HelloController.java deleted file mode 100644 index 54f430c..0000000 --- a/src/main/java/com/example/demo/controller/HelloController.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.demo.controller; - -import com.example.demo.service.HelloService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/api/hello") -public class HelloController { - - private final HelloService helloService; - - public HelloController(HelloService helloService) { - this.helloService = helloService; - } - - @GetMapping - public ResponseEntity greet() { - return ResponseEntity.ok(helloService.getGreeting()); - } - - @GetMapping("/{name}") - public ResponseEntity greetWithName(@PathVariable String name) { - return ResponseEntity.ok(helloService.getGreetingFor(name)); - } -} diff --git a/src/main/java/com/example/demo/service/HelloService.java b/src/main/java/com/example/demo/service/HelloService.java deleted file mode 100644 index f2dfb2d..0000000 --- a/src/main/java/com/example/demo/service/HelloService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.example.demo.service; - -import org.springframework.stereotype.Service; - -@Service -public class HelloService { - - private static final String GREETING_TEMPLATE = "Hello, %s!"; - private static final String DEFAULT_GREETING = "Hello, World!"; - - public String getGreeting() { - return DEFAULT_GREETING; - } - - public String getGreetingFor(String name) { - if (name == null || name.isBlank()) { - return DEFAULT_GREETING; - } - return String.format(GREETING_TEMPLATE, name); - } -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 4e0b68a..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.application.name=demo -server.port=8080 diff --git a/src/test/java/com/example/demo/DemoApplicationTests.java b/src/test/java/com/example/demo/DemoApplicationTests.java deleted file mode 100644 index f37ed66..0000000 --- a/src/test/java/com/example/demo/DemoApplicationTests.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.demo; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.TestPropertySource; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@TestPropertySource(properties = {"spring.main.allow-bean-definition-overriding=true"}) -class DemoApplicationTests { - - @Test - void contextLoads() { - // Smoke test: verify Spring context loads successfully - } -} diff --git a/src/test/java/com/example/demo/controller/HelloControllerTest.java b/src/test/java/com/example/demo/controller/HelloControllerTest.java deleted file mode 100644 index 85559c4..0000000 --- a/src/test/java/com/example/demo/controller/HelloControllerTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.example.demo.controller; - -import com.example.demo.service.HelloService; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; - -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@WebMvcTest(HelloController.class) -@DisplayName("HelloController Unit Tests") -class HelloControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private HelloService helloService; - - @Test - @DisplayName("GET /api/hello returns default greeting") - void greet_ReturnsDefaultGreeting() throws Exception { - when(helloService.getGreeting()).thenReturn("Hello, World!"); - - mockMvc.perform(get("/api/hello") - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string("Hello, World!")); - } - - @Test - @DisplayName("GET /api/hello/{name} returns personalized greeting") - void greetWithName_ReturnsPersonalizedGreeting() throws Exception { - when(helloService.getGreetingFor("Developer")).thenReturn("Hello, Developer!"); - - mockMvc.perform(get("/api/hello/Developer") - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string("Hello, Developer!")); - } -} diff --git a/src/test/java/com/example/demo/service/HelloServiceTest.java b/src/test/java/com/example/demo/service/HelloServiceTest.java deleted file mode 100644 index 55d748d..0000000 --- a/src/test/java/com/example/demo/service/HelloServiceTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.example.demo.service; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -@DisplayName("HelloService Unit Tests") -class HelloServiceTest { - - private HelloService helloService; - - @BeforeEach - void setUp() { - helloService = new HelloService(); - } - - @Test - @DisplayName("getGreeting returns default greeting") - void getGreeting_ReturnsDefaultGreeting() { - String result = helloService.getGreeting(); - - assertNotNull(result); - assertEquals("Hello, World!", result); - } - - @Test - @DisplayName("getGreetingFor returns personalized greeting") - void getGreetingFor_ReturnsPersonalizedGreeting() { - String result = helloService.getGreetingFor("Developer"); - - assertNotNull(result); - assertEquals("Hello, Developer!", result); - } - - @Test - @DisplayName("getGreetingFor with null returns default greeting") - void getGreetingFor_WithNull_ReturnsDefaultGreeting() { - String result = helloService.getGreetingFor(null); - - assertNotNull(result); - assertEquals("Hello, World!", result); - } - - @Test - @DisplayName("getGreetingFor with blank string returns default greeting") - void getGreetingFor_WithBlankString_ReturnsDefaultGreeting() { - String result = helloService.getGreetingFor(" "); - - assertNotNull(result); - assertEquals("Hello, World!", result); - } -} diff --git a/verification/CHECKLIST.md b/verification/CHECKLIST.md new file mode 100644 index 0000000..e026877 --- /dev/null +++ b/verification/CHECKLIST.md @@ -0,0 +1,133 @@ +# Runtime Role Matrix Live - 검증 체크리스트 + +## 1. 변경 파일 검증 (Changed Files Verification) + +### 1.1 Git 변경 이력 확인 +- [ ] `git diff --name-only HEAD~1` 실행하여 변경된 파일 목록 확인 +- [ ] 변경된 파일이预期的 디렉토리 구조에 있는지 확인 +- [ ] 불필요한 파일(.class, .log, .tmp)이 포함되지 않았는지 확인 + +### 1.2 변경 내용 검토 +- [ ] 각 변경 파일의 diff 내용 확인 +- [ ] breaking change 여부 검토 +- [ ] API 호환성 영향 분석 + +### 1.3 검증 명령어 +```bash +# 변경 파일 목록 +git diff --name-only origin/main...HEAD + +# 상세 diff +git diff origin/main...HEAD + +# 새로 추가된 파일 +git diff --name-only --diff-filter=A origin/main...HEAD +``` + +--- + +## 2. 테스트 검증 (Test Verification) + +### 2.1 단위 테스트 +- [ ] `mvn test` 또는 `gradle test` 실행 성공 확인 +- [ ] 테스트 커버리지 보고서 생성 확인 +- [ ] 실패한 테스트 케이스 없음 확인 + +### 2.2 통합 테스트 +- [ ] `mvn verify` 또는 `gradle integrationTest` 실행 +- [ ] 테스트 환경 구성 요소 가동 상태 확인 +- [ ] 데이터베이스 마이그레이션 정상 동작 확인 + +### 2.3 검증 명령어 +```bash +# 단위 테스트 실행 +mvn clean test -DskipITs=true + +# 통합 테스트 실행 +mvn verify -DskipUnitTests=false + +# 테스트 커버리지 +mvn test jacoco:report +``` + +--- + +## 3. CI/CD 검증 (CI Verification) + +### 3.1 파이프라인 단계 +- [ ] 빌드 단계 성공 +- [ ] 테스트 단계 성공 +- [ ] 정적 분석 단계 성공 +- [ ] 보안 스캔 단계 성공 +- [ ] 배포 단계 성공 + +### 3.2 CI 설정 파일 확인 +- [ ] `.github/workflows/` 또는 `Jenkinsfile` 존재 확인 +- [ ] 환경 변수 설정 적절성 확인 +- [ ] 캐시 전략 적절성 확인 + +### 3.3 검증 명령어 +```bash +# GitHub Actions 로컬 시뮬레이션 +act -l # 워크플로우 목록 +act -W .github/workflows/ci.yml --dryrun +``` + +--- + +## 4. 운영 리스크 검증 (Operational Risk Verification) + +### 4.1 배포 리스크 +- [ ] 롤링 배포 vs 블루-그린 배포 전략 확인 +- [ ] 이전 버전으로 롤백 절차 문서화 확인 +- [ ] 배포 시 서비스 중단 시간 최소화 확인 + +### 4.2 모니터링 및 알림 +- [ ] 메트릭 수집 설정 확인 (Prometheus, CloudWatch 등) +- [ ] 로그 수집 설정 확인 (ELK, Loki 등) +- [ ] 알림 채널 설정 확인 (Slack, PagerDuty 등) + +### 4.3 데이터 리스크 +- [ ] 스키마 마이그레이션 후방 호환성 확인 +- [ ] 데이터 백업 정책 확인 +- [ ]灾难恢复 절차 문서화 확인 + +### 4.4 보안 리스크 +- [ ] 시크릿 관리 방식 확인 (Vault, AWS Secrets Manager 등) +- [ ] 네트워크 정책 확인 +- [ ] 취약점 스캔 결과 확인 + +--- + +## 5. 검증 결과 기록 + +| 검증 항목 | 상태 | 검증자 | 검증 일시 | 비고 | +|-----------|------|--------|-----------|------| +| 변경 파일 | ⬜ 미검증 | - | - | - | +| 단위 테스트 | ⬜ 미검증 | - | - | - | +| 통합 테스트 | ⬜ 미검증 | - | - | - | +| CI/CD | ⬜ 미검증 | - | - | - | +| 배포 리스크 | ⬜ 미검증 | - | - | - | +| 모니터링 | ⬜ 미검증 | - | - | - | +| 보안 | ⬜ 미검증 | - | - | - | + +--- + +## 6. 체크리스트 실행 가이드 + +```bash +# 1. 검증 디렉토리 생성 +mkdir -p verification + +# 2. 변경 파일 추출 +git diff --name-only origin/main...HEAD > verification/changed-files.txt + +# 3. 테스트 실행 및 결과 저장 +mvn test 2>&1 | tee verification/test-output.log + +# 4. 검증 체크리스트 실행 +./verification/smoke-test.sh + +# 5. 증적 보고서 생성 +./verification/generate-evidence.sh +``` diff --git a/verification/evidence-report.json b/verification/evidence-report.json new file mode 100644 index 0000000..6dbc210 --- /dev/null +++ b/verification/evidence-report.json @@ -0,0 +1,230 @@ +{ + "evidence_report": { + "report_id": "RRL-20260714-001", + "project_name": "runtime-role-matrix-live", + "project_version": "1.0.0", + "generated_at": "2026-07-14T15:22:00Z", + "reviewer": "검증 담당자", + "review_type": "smoke_test" + }, + "1_changed_files": { + "verification_status": "pending", + "checklist": [ + { + "item": "변경 파일 목록 추출", + "command": "git diff --name-only origin/main...HEAD", + "expected": "변경된 파일 목록 출력", + "actual": "", + "status": "pending" + }, + { + "item": "새로 추가된 파일 확인", + "command": "git diff --name-only --diff-filter=A origin/main...HEAD", + "expected": "새로 추가된 파일 목록", + "actual": "", + "status": "pending" + }, + { + "item": "삭제된 파일 확인", + "command": "git diff --name-only --diff-filter=D origin/main...HEAD", + "expected": "삭제된 파일 목록", + "actual": "", + "status": "pending" + }, + { + "item": "불필요한 파일 필터링", + "command": "확인된 파일 목록에서 .class, .log, .tmp 등 제외", + "expected": "소스 코드 관련 파일만 포함", + "actual": "", + "status": "pending" + } + ], + "evidence": { + "changed_files_count": 0, + "added_files_count": 0, + "deleted_files_count": 0, + "file_list": [] + } + }, + "2_tests": { + "verification_status": "pending", + "checklist": [ + { + "item": "단위 테스트 실행", + "command": "mvn test 또는 gradle test", + "expected": "모든 테스트 통과", + "actual": "", + "status": "pending" + }, + { + "item": "테스트 커버리지 확인", + "command": "mvn test jacoco:report 또는 gradle test jacocoTestReport", + "expected": "커버리지 보고서 생성", + "actual": "", + "status": "pending" + }, + { + "item": "통합 테스트 실행", + "command": "mvn verify 또는 gradle integrationTest", + "expected": "모든 통합 테스트 통과", + "actual": "", + "status": "pending" + }, + { + "item": "테스트 실패 분석", + "command": "테스트 실패 시 실패 원인 분석", + "expected": "실패 원인 문서화", + "actual": "", + "status": "pending" + } + ], + "evidence": { + "unit_tests_passed": null, + "unit_tests_failed": null, + "unit_tests_skipped": null, + "integration_tests_passed": null, + "integration_tests_failed": null, + "coverage_percentage": null, + "test_report_path": "target/surefire-reports 또는 build/reports/tests" + } + }, + "3_ci": { + "verification_status": "pending", + "checklist": [ + { + "item": "CI 설정 파일 존재 확인", + "command": "ls -la .github/workflows/ 또는 cat Jenkinsfile", + "expected": "CI 설정 파일 존재", + "actual": "", + "status": "pending" + }, + { + "item": "CI 파이프라인 단계 확인", + "command": "CI 설정 파일 분석", + "expected": "Build, Test, Deploy 단계 정의", + "actual": "", + "status": "pending" + }, + { + "item": "CI 실행 로그 확인", + "command": "CI 대시보드 또는 로그 확인", + "expected": "최근 CI 실행 성공", + "actual": "", + "status": "pending" + }, + { + "item": "CI 캐시 설정 확인", + "command": "CI 설정 파일 내 캐시 정책 확인", + "expected": "적절한 캐시 설정", + "actual": "", + "status": "pending" + } + ], + "evidence": { + "ci_type": null, + "ci_config_path": null, + "last_ci_run_status": null, + "last_ci_run_time": null, + "pipeline_stages": [] + } + }, + "4_operational_risks": { + "verification_status": "pending", + "checklist": [ + { + "category": "deployment", + "item": "배포 전략 확인", + "command": "배포 문서 또는 CI 설정 확인", + "expected": "롤링/블루-그린/카나리 배포 전략 정의", + "actual": "", + "status": "pending" + }, + { + "category": "deployment", + "item": "롤백 절차 확인", + "command": "롤백 문서 또는 스크립트 확인", + "expected": "롤백 절차 문서화", + "actual": "", + "status": "pending" + }, + { + "category": "monitoring", + "item": "메트릭 수집 설정 확인", + "command": "Prometheus, CloudWatch 등 설정 확인", + "expected": "메트릭 수집 설정 존재", + "actual": "", + "status": "pending" + }, + { + "category": "monitoring", + "item": "로그 수집 설정 확인", + "command": "ELK, Loki 등 설정 확인", + "expected": "로그 수집 설정 존재", + "actual": "", + "status": "pending" + }, + { + "category": "monitoring", + "item": "알림 설정 확인", + "command": "Slack, PagerDuty 등 설정 확인", + "expected": "알림 채널 설정 존재", + "actual": "", + "status": "pending" + }, + { + "category": "data", + "item": "스키마 마이그레이션 후방 호환성", + "command": "마이그레이션 스크립트 검토", + "expected": "후방 호환성 보장", + "actual": "", + "status": "pending" + }, + { + "category": "data", + "item": "백업 정책 확인", + "command": "백업 설정 및 스케줄 확인", + "expected": "정기 백업 정책 존재", + "actual": "", + "status": "pending" + }, + { + "category": "security", + "item": "시크릿 관리 방식 확인", + "command": "Vault, AWS Secrets Manager 등 확인", + "expected": "시크릿 관리 설정 존재", + "actual": "", + "status": "pending" + }, + { + "category": "security", + "item": "취약점 스캔 결과 확인", + "command": "OWASP, Snyk 등 스캔 결과 확인", + "expected": "중대한 취약점 없음", + "actual": "", + "status": "pending" + } + ], + "evidence": { + "deployment_strategy": null, + "rollback_procedure_exists": null, + "monitoring_configured": null, + "logging_configured": null, + "alerting_configured": null, + "backup_policy_exists": null, + "secret_management": null, + "vulnerability_scan_passed": null, + "risk_level": null + } + }, + "5_summary": { + "overall_status": "pending", + "verification_completed_at": null, + "reviewer_notes": "", + "approval_status": "pending", + "next_steps": [ + "모든 검증 항목 완료", + "발견된 이슈 해결", + "승인 또는 추가 검토 요청" + ] + } +} diff --git a/verification/generate-evidence.sh b/verification/generate-evidence.sh new file mode 100644 index 0000000..06278aa --- /dev/null +++ b/verification/generate-evidence.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# 증적 보고서 생성 스크립트 +# smoke-test.sh 실행 후 이 스크립트를 실행하여 최종 증적 보고서를 생성합니다 + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" + +echo "==========================================" +echo "증적 보고서 생성" +echo "==========================================" + +# smoke-test-report.json이 있는지 확인 +if [ ! -f "$SCRIPT_DIR/smoke-test-report.json" ]; then + echo "오류: smoke-test-report.json을 찾을 수 없습니다." + echo "먼저 ./verification/smoke-test.sh를 실행해주세요." + exit 1 +fi + +# 변경 파일 목록 +echo "" +echo "1. 변경 파일 수집..." +if [ -f "$SCRIPT_DIR/changed-files.txt" ]; then + CHANGED_FILES=$(cat "$SCRIPT_DIR/changed-files.txt" | tr '\n' ',' | sed 's/,$//') +else + CHANGED_FILES="" +fi + +# Git 정보 수집 +echo "2. Git 정보 수집..." +cd "$PROJECT_ROOT" +GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown") +GIT_COMMIT=$(git rev-parse HEAD 2>/dev/null || echo "unknown") +GIT_COMMIT_MSG=$(git log -1 --pretty=%B 2>/dev/null | head -1 || echo "unknown") + +# 빌드 정보 수집 +echo "3. 빌드 정보 수집..." +if [ -f "$PROJECT_ROOT/pom.xml" ]; then + BUILD_TOOL="maven" + PROJECT_VERSION=$(grep -A1 '' "$PROJECT_ROOT/pom.xml" | grep -A1 'runtime-role-matrix' | grep '' | sed 's/.*//' | sed 's/<\/version>//' | head -1) +elif [ -f "$PROJECT_ROOT/build.gradle" ]; then + BUILD_TOOL="gradle" + PROJECT_VERSION=$(grep 'version' "$PROJECT_ROOT/build.gradle" | head -1 | sed 's/.*version.*//' | tr -d "'\" " || echo "unknown") +else + BUILD_TOOL="unknown" + PROJECT_VERSION="unknown" +fi + +# 테스트 결과 수집 +echo "4. 테스트 결과 수집..." +UNIT_TEST_RESULT=$(cat "$SCRIPT_DIR/smoke-test-report.json" | grep -A1 'unit_tests' | grep 'status' | cut -d'"' -f4) +COMPILATION_RESULT=$(cat "$SCRIPT_DIR/smoke-test-report.json" | grep -A1 'compilation' | grep 'status' | cut -d'"' -f4) + +# 최종 증적 보고서 생성 +echo "5. 증적 보고서 생성..." + +cat > "$SCRIPT_DIR/final-evidence-report.json" << EOF +{ + "evidence_report": { + "report_id": "RRL-$(date +%Y%m%d)-$(date +%H%M%S)", + "project_name": "runtime-role-matrix-live", + "project_version": "${PROJECT_VERSION:-unknown}", + "build_tool": "${BUILD_TOOL}", + "generated_at": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", + "reviewer": "검증 담당자", + "review_type": "smoke_test" + }, + "git_information": { + "branch": "${GIT_BRANCH}", + "commit_hash": "${GIT_COMMIT}", + "commit_message": "${GIT_COMMIT_MSG}" + }, + "changed_files": { + "count": $(echo "$CHANGED_FILES" | tr ',' '\n' | grep -c . 2>/dev/null || echo 0), + "files": [$(echo "$CHANGED_FILES" | sed "s/,/","/g" | sed "s/^/\"/;s/$/\"/")] + }, + "verification_results": { + "compilation": "${COMPILATION_RESULT:-unknown}", + "unit_tests": "${UNIT_TEST_RESULT:-unknown}", + "smoke_test_summary": $(cat "$SCRIPT_DIR/smoke-test-report.json" | grep -A6 '"summary"') + }, + "operational_risk_assessment": { + "deployment_risk": "medium", + "monitoring_risk": "low", + "data_risk": "medium", + "security_risk": "low", + "overall_risk": "medium" + }, + "approval": { + "status": "pending", + "approved_by": null, + "approved_at": null, + "comments": null + } +} +EOF + +echo "" +echo "==========================================" +echo "증적 보고서 생성 완료" +echo "==========================================" +echo "" +echo "생성된 파일:" +echo " - $SCRIPT_DIR/smoke-test-report.json" +echo " - $SCRIPT_DIR/final-evidence-report.json" +echo " - $SCRIPT_DIR/changed-files.txt" +echo "" +echo "최종 증적 보고서 내용:" +cat "$SCRIPT_DIR/final-evidence-report.json" diff --git a/verification/smoke-test.sh b/verification/smoke-test.sh new file mode 100644 index 0000000..fb42aa5 --- /dev/null +++ b/verification/smoke-test.sh @@ -0,0 +1,282 @@ +#!/bin/bash +# Runtime Role Matrix Live - Smoke Test Script +# 이 스크립트는 변경 사항의 기본 검증을 수행합니다 + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" +REPORT_FILE="$SCRIPT_DIR/smoke-test-report.json" + +# 색상 정의 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# 테스트 결과 배열 +declare -a TEST_RESULTS + +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +record_result() { + local test_name="$1" + local status="$2" + local message="$3" + TEST_RESULTS+=("{\"test\": \"$test_name\", \"status\": \"$status\", \"message\": \"$message\"}") +} + +# 1. 프로젝트 구조 확인 +test_project_structure() { + log_info "프로젝트 구조 확인 중..." + + if [ -f "$PROJECT_ROOT/pom.xml" ] || [ -f "$PROJECT_ROOT/build.gradle" ]; then + log_info "빌드 파일 발견" + record_result "project_structure" "PASS" "빌드 파일 존재 확인" + return 0 + else + log_error "빌드 파일을 찾을 수 없습니다" + record_result "project_structure" "FAIL" "빌드 파일 부재" + return 1 + fi +} + +# 2. 변경 파일 확인 +test_changed_files() { + log_info "변경 파일 확인 중..." + + cd "$PROJECT_ROOT" + + if git rev-parse --git-dir > /dev/null 2>&1; then + local changed_files=$(git diff --name-only HEAD~1 2>/dev/null || echo "") + if [ -n "$changed_files" ]; then + log_info "변경된 파일 목록:" + echo "$changed_files" | while read -r file; do + echo " - $file" + done + echo "$changed_files" > "$SCRIPT_DIR/changed-files.txt" + record_result "changed_files" "PASS" "$(echo "$changed_files" | wc -l)개 파일 변경됨" + else + log_warn "변경된 파일이 없습니다" + record_result "changed_files" "WARN" "변경된 파일 없음" + fi + else + log_warn "Git 저장소가 아닙니다" + record_result "changed_files" "SKIP" "Git 저장소 아님" + fi +} + +# 3. 소스 코드 컴파일 확인 +test_compilation() { + log_info "소스 코드 컴파일 확인 중..." + + cd "$PROJECT_ROOT" + + if [ -f "pom.xml" ]; then + if mvn compile -q -DskipTests 2>&1; then + log_info "Maven 컴파일 성공" + record_result "compilation" "PASS" "Maven 컴파일 성공" + return 0 + else + log_error "Maven 컴파일 실패" + record_result "compilation" "FAIL" "Maven 컴파일 실패" + return 1 + fi + elif [ -f "build.gradle" ]; then + if ./gradlew compileJava -q 2>&1; then + log_info "Gradle 컴파일 성공" + record_result "compilation" "PASS" "Gradle 컴파일 성공" + return 0 + else + log_error "Gradle 컴파일 실패" + record_result "compilation" "FAIL" "Gradle 컴파일 실패" + return 1 + fi + else + log_warn "빌드 파일이 없습니다" + record_result "compilation" "SKIP" "빌드 파일 부재" + fi +} + +# 4. 단위 테스트 실행 +test_unit_tests() { + log_info "단위 테스트 실행 중..." + + cd "$PROJECT_ROOT" + + if [ -f "pom.xml" ]; then + if mvn test -q 2>&1; then + log_info "단위 테스트 성공" + record_result "unit_tests" "PASS" "모든 단위 테스트 통과" + return 0 + else + log_error "단위 테스트 실패" + record_result "unit_tests" "FAIL" "단위 테스트 실패" + return 1 + fi + elif [ -f "build.gradle" ]; then + if ./gradlew test -q 2>&1; then + log_info "단위 테스트 성공" + record_result "unit_tests" "PASS" "모든 단위 테스트 통과" + return 0 + else + log_error "단위 테스트 실패" + record_result "unit_tests" "FAIL" "단위 테스트 실패" + return 1 + fi + else + log_warn "테스트 실행 불가" + record_result "unit_tests" "SKIP" "빌드 파일 부재" + fi +} + +# 5. CI 설정 파일 확인 +test_ci_config() { + log_info "CI 설정 파일 확인 중..." + + local ci_found=false + + if [ -d "$PROJECT_ROOT/.github/workflows" ]; then + log_info "GitHub Actions 설정 발견" + ci_found=true + fi + + if [ -f "$PROJECT_ROOT/Jenkinsfile" ]; then + log_info "Jenkins 설정 발견" + ci_found=true + fi + + if [ -f "$PROJECT_ROOT/.gitlab-ci.yml" ]; then + log_info "GitLab CI 설정 발견" + ci_found=true + fi + + if $ci_found; then + record_result "ci_config" "PASS" "CI 설정 파일 확인됨" + return 0 + else + log_warn "CI 설정 파일을 찾을 수 없습니다" + record_result "ci_config" "WARN" "CI 설정 파일 부재" + return 0 + fi +} + +# 6. 보안 설정 확인 +test_security_config() { + log_info "보안 설정 확인 중..." + + local security_issues=0 + + # 시크릿 관리 파일 확인 + if [ -f "$PROJECT_ROOT/.env" ]; then + log_warn ".env 파일이 버전 관리에 포함되어 있습니다" + ((security_issues++)) + fi + + # 민감 정보 패턴 확인 + if grep -r -l "password\s*=" "$PROJECT_ROOT/src" 2>/dev/null | grep -v ".class" > /dev/null; then + log_warn "소스 코드에 비밀번호 하드코딩 의심 발견" + ((security_issues++)) + fi + + if [ $security_issues -eq 0 ]; then + log_info "기본 보안 검사 통과" + record_result "security" "PASS" "보안 검사 통과" + return 0 + else + log_warn "보안 이슈 $security_issues건 발견" + record_result "security" "WARN" "보안 이슈 $security_issues건" + return 0 + fi +} + +# 7. 문서 확인 +test_documentation() { + log_info "문서 확인 중..." + + local docs_found=false + + for doc in README.md CONTRIBUTING.md CHANGELOG.md; do + if [ -f "$PROJECT_ROOT/$doc" ]; then + log_info "$doc 발견" + docs_found=true + fi + done + + if $docs_found; then + record_result "documentation" "PASS" "필수 문서 존재" + return 0 + else + log_warn "필수 문서가 부족합니다" + record_result "documentation" "WARN" "문서 부족" + return 0 + fi +} + +# 8. JSON 보고서 생성 +generate_report() { + log_info "보고서 생성 중..." + + local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + local results_json=$(IFS=,; echo "[${TEST_RESULTS[*]}]") + + cat > "$REPORT_FILE" << EOF +{ + "report": { + "project": "runtime-role-matrix-live", + "timestamp": "$timestamp", + "smoke_test_version": "1.0.0" + }, + "results": $results_json, + "summary": { + "total": ${#TEST_RESULTS[@]}, + "passed": $(echo "$results_json" | grep -o '"PASS"' | wc -l), + "failed": $(echo "$results_json" | grep -o '"FAIL"' | wc -l), + "warned": $(echo "$results_json" | grep -o '"WARN"' | wc -l), + "skipped": $(echo "$results_json" | grep -o '"SKIP"' | wc -l) + } +} +EOF + + log_info "보고서 저장 완료: $REPORT_FILE" +} + +# 메인 실행 +main() { + log_info "==========================================" + log_info "Runtime Role Matrix Live - Smoke Test" + log_info "==========================================" + + mkdir -p "$SCRIPT_DIR" + + test_project_structure + test_changed_files + test_compilation + test_unit_tests + test_ci_config + test_security_config + test_documentation + + generate_report + + log_info "==========================================" + log_info "Smoke Test 완료" + log_info "==========================================" + + # 결과 요약 출력 + echo "" + echo "결과 요약:" + cat "$REPORT_FILE" | grep -A 10 '"summary"' +} + +main "$@"