feat: consolidate env config and add deployment files
- Add debug_font_path, demo_docs_dir, e2e_api_base_url to config.py - Fix hardcoded paths in pp_structure_debug.py, create_demo_images.py - Fix hardcoded paths in test files - Update .env.example with new configuration options - Update .gitignore to exclude AI development files (.claude/, openspec/, AGENTS.md, CLAUDE.md) - Add production startup script (start-prod.sh) - Add README.md with project documentation - Add 1panel Docker deployment files (docker-compose.yml, Dockerfiles, nginx.conf) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Run all PP-StructureV3 parameter tests
|
||||
# Run backend test suites
|
||||
# Usage: ./backend/tests/run_ppstructure_tests.sh [test_type]
|
||||
# test_type: unit, api, e2e, performance, all (default: all)
|
||||
# test_type: unit, api, e2e, all (default: all)
|
||||
|
||||
set -e
|
||||
|
||||
@@ -30,25 +30,32 @@ NC='\033[0m' # No Color
|
||||
TEST_TYPE="${1:-all}"
|
||||
|
||||
echo -e "${BLUE}========================================${NC}"
|
||||
echo -e "${BLUE}PP-StructureV3 Parameters Test Suite${NC}"
|
||||
echo -e "${BLUE}Tool_OCR Backend Test Runner${NC}"
|
||||
echo -e "${BLUE}========================================${NC}"
|
||||
echo ""
|
||||
|
||||
# Derive API base URL for E2E checks (same env vars used by pytest e2e tests)
|
||||
DEFAULT_BACKEND_PORT="${BACKEND_PORT:-8000}"
|
||||
DEFAULT_API_BASE_URL="http://localhost:${DEFAULT_BACKEND_PORT}"
|
||||
E2E_API_BASE_URL="${TOOL_OCR_E2E_API_BASE_URL:-$DEFAULT_API_BASE_URL}"
|
||||
|
||||
# Function to run tests
|
||||
run_tests() {
|
||||
local test_name=$1
|
||||
local test_path=$2
|
||||
local markers=$3
|
||||
shift 3
|
||||
local extra_args=("$@")
|
||||
|
||||
echo -e "${GREEN}Running ${test_name}...${NC}"
|
||||
|
||||
if [ -n "$markers" ]; then
|
||||
pytest "$test_path" -v -m "$markers" --tb=short || {
|
||||
pytest "$test_path" -v -m "$markers" --tb=short "${extra_args[@]}" || {
|
||||
echo -e "${RED}✗ ${test_name} failed${NC}"
|
||||
return 1
|
||||
}
|
||||
else
|
||||
pytest "$test_path" -v --tb=short || {
|
||||
pytest "$test_path" -v --tb=short "${extra_args[@]}" || {
|
||||
echo -e "${RED}✗ ${test_name} failed${NC}"
|
||||
return 1
|
||||
}
|
||||
@@ -63,28 +70,29 @@ case "$TEST_TYPE" in
|
||||
unit)
|
||||
echo -e "${YELLOW}Running Unit Tests...${NC}"
|
||||
echo ""
|
||||
run_tests "Unit Tests" "backend/tests/services/test_ppstructure_params.py" ""
|
||||
run_tests "Unit Tests" "backend/tests" "not integration" \
|
||||
--ignore=backend/tests/api --ignore=backend/tests/e2e
|
||||
;;
|
||||
|
||||
api)
|
||||
echo -e "${YELLOW}Running API Integration Tests...${NC}"
|
||||
echo ""
|
||||
run_tests "API Tests" "backend/tests/api/test_ppstructure_params_api.py" ""
|
||||
run_tests "API Tests" "backend/tests/api" "not integration"
|
||||
;;
|
||||
|
||||
e2e)
|
||||
echo -e "${YELLOW}Running E2E Tests...${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}⚠ Note: E2E tests require backend server running${NC}"
|
||||
echo -e "${YELLOW}⚠ Credentials: ymirliu@panjit.com.tw / 4RFV5tgb6yhn${NC}"
|
||||
echo -e "${YELLOW}⚠ Provide credentials via TOOL_OCR_E2E_USERNAME / TOOL_OCR_E2E_PASSWORD${NC}"
|
||||
echo ""
|
||||
run_tests "E2E Tests" "backend/tests/e2e/test_ppstructure_params_e2e.py" "e2e"
|
||||
run_tests "E2E Tests" "backend/tests/e2e" ""
|
||||
;;
|
||||
|
||||
performance)
|
||||
echo -e "${YELLOW}Running Performance Tests...${NC}"
|
||||
echo ""
|
||||
run_tests "Performance Tests" "backend/tests/performance/test_ppstructure_params_performance.py" "performance"
|
||||
echo -e "${RED}Performance suite no longer exists.${NC}"
|
||||
echo "Use: $0 unit | $0 api | $0 e2e | $0 all"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
all)
|
||||
@@ -92,28 +100,26 @@ case "$TEST_TYPE" in
|
||||
echo ""
|
||||
|
||||
# Unit tests
|
||||
run_tests "Unit Tests" "backend/tests/services/test_ppstructure_params.py" ""
|
||||
run_tests "Unit Tests" "backend/tests" "not integration" \
|
||||
--ignore=backend/tests/api --ignore=backend/tests/e2e
|
||||
|
||||
# API tests
|
||||
run_tests "API Tests" "backend/tests/api/test_ppstructure_params_api.py" ""
|
||||
|
||||
# Performance tests
|
||||
run_tests "Performance Tests" "backend/tests/performance/test_ppstructure_params_performance.py" "performance"
|
||||
run_tests "API Tests" "backend/tests/api" "not integration"
|
||||
|
||||
# E2E tests (optional, requires server)
|
||||
echo -e "${YELLOW}E2E Tests (requires server running)...${NC}"
|
||||
if curl -s http://localhost:8000/health > /dev/null 2>&1; then
|
||||
run_tests "E2E Tests" "backend/tests/e2e/test_ppstructure_params_e2e.py" "e2e"
|
||||
if curl -s "${E2E_API_BASE_URL%/}/health" > /dev/null 2>&1; then
|
||||
run_tests "E2E Tests" "backend/tests/e2e" ""
|
||||
else
|
||||
echo -e "${YELLOW}⚠ Skipping E2E tests - server not running${NC}"
|
||||
echo -e "${YELLOW} Start server with: cd backend && python -m uvicorn app.main:app${NC}"
|
||||
echo -e "${YELLOW} Expected health endpoint: ${E2E_API_BASE_URL%/}/health${NC}"
|
||||
echo ""
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo -e "${RED}Invalid test type: $TEST_TYPE${NC}"
|
||||
echo "Usage: $0 [unit|api|e2e|performance|all]"
|
||||
echo "Usage: $0 [unit|api|e2e|all]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user