# ============================================================================== # TEST & QUALITY (unit tests, lint, format) # ============================================================================== .PHONY: test test-tmt lint fmt status test-web test-backend-api test-chat-server test-stream-server .PHONY: lint-web lint-backend-api lint-chat-server lint-stream-server test: infra-up ## [MID] Run All Tests (Fastest strategy) @$(ECHO_CMD) "${BLUE}🧪 Running Tests...${NC}" @$(ECHO_CMD) " [Go] Unit Tests..." @(cd $(ROOT)/$(SERVICE_DIR_backend-api) && go test ./... -short) @$(ECHO_CMD) " [Rust] Unit Tests..." @(cd $(ROOT)/$(SERVICE_DIR_chat-server) && cargo test --lib -q) @(cd $(ROOT)/$(SERVICE_DIR_stream-server) && cargo test --lib -q) @$(ECHO_CMD) " [Web] Unit Tests..." @(cd $(ROOT)/$(SERVICE_DIR_web) && npm run test -- --run) @$(ECHO_CMD) "${GREEN}✅ All tests passed.${NC}" test-tmt: ## [MID] Run Unified TMT Pipeline @$(ECHO_CMD) "${BLUE}🧪 Running TMT Pipeline...${NC}" @command -v tmt >/dev/null 2>&1 || { $(ECHO_CMD) "${RED}❌ tmt is missing! Install with 'pip install tmt'${NC}"; exit 1; } @tmt run test-web: ## [MID] Run Web tests only @$(ECHO_CMD) "${BLUE}🧪 Running Web tests...${NC}" @(cd $(ROOT)/$(SERVICE_DIR_web) && npm run test -- --run) test-backend-api: ## [MID] Run Go backend tests only @$(ECHO_CMD) "${BLUE}🧪 Running Backend API tests...${NC}" @(cd $(ROOT)/$(SERVICE_DIR_backend-api) && go test ./... -short) test-chat-server: ## [MID] Run Chat server tests only @$(ECHO_CMD) "${BLUE}🧪 Running Chat server tests...${NC}" @(cd $(ROOT)/$(SERVICE_DIR_chat-server) && cargo test --lib -q) test-stream-server: ## [MID] Run Stream server tests only @$(ECHO_CMD) "${BLUE}🧪 Running Stream server tests...${NC}" @(cd $(ROOT)/$(SERVICE_DIR_stream-server) && cargo test --lib -q) lint: ## [MID] Lint everything @$(ECHO_CMD) "${BLUE}🔍 Linting Codebase...${NC}" @(cd $(ROOT)/$(SERVICE_DIR_chat-server) && cargo clippy -- -D warnings) || true @(cd $(ROOT)/$(SERVICE_DIR_stream-server) && cargo clippy -- -D warnings) || true @(cd $(ROOT)/$(SERVICE_DIR_backend-api) && golangci-lint run ./...) || true @(cd $(ROOT)/$(SERVICE_DIR_web) && npm run lint) || true lint-web: ## [MID] Lint web app only @(cd $(ROOT)/$(SERVICE_DIR_web) && npm run lint) lint-backend-api: ## [MID] Lint Go backend only @(cd $(ROOT)/$(SERVICE_DIR_backend-api) && golangci-lint run ./...) lint-chat-server: ## [MID] Lint Chat server only @(cd $(ROOT)/$(SERVICE_DIR_chat-server) && cargo clippy -- -D warnings) lint-stream-server: ## [MID] Lint Stream server only @(cd $(ROOT)/$(SERVICE_DIR_stream-server) && cargo clippy -- -D warnings) fmt: ## [MID] Format everything @$(ECHO_CMD) "${BLUE}✨ Formatting...${NC}" @(cd $(ROOT)/$(SERVICE_DIR_backend-api) && go fmt ./...) @(cd $(ROOT)/$(SERVICE_DIR_chat-server) && cargo fmt) @(cd $(ROOT)/$(SERVICE_DIR_stream-server) && cargo fmt) @(cd $(ROOT)/$(SERVICE_DIR_web) && npm run format) || true status: ## [MID] Show system health & stats @$(ECHO_CMD) "${BOLD}DOCKER STATS:${NC}" @docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}" 2>/dev/null | grep -E "NAME|veza" || echo "No containers running" @$(ECHO_CMD) "" @$(ECHO_CMD) "${BOLD}LOCAL PORTS:${NC}" @lsof -i :$(PORT_backend-api) -i :$(PORT_chat-server) -i :$(PORT_stream-server) -i :$(PORT_web) 2>/dev/null | grep LISTEN || echo "No apps listening."