Moved 25 files from root to organized subdirectories while keeping essential scripts (install.sh, setup.sh, start*.sh, stop*.sh) in root. ## Changes: ### New Directory Structure: - Created `/scripts/` for utility scripts - Created `/docs/guides/` for user guides - Created `/docs/development/` for dev documentation - Created `/docs/archive/` for historical/legacy docs ### Moved Files: **To `/scripts/` (7 files):** - backup_claude_os.sh - restore_claude_os.sh - run_tests.sh - setup_native.sh - start_mcp_server.sh - start_redis_workers.sh - entrypoint.sh **To `/docs/guides/` (7 files):** - AUTH_SETUP.md - BACKUP_RESTORE_GUIDE.md - HOOK_SETUP_QUICK_START.md - SHARING_GUIDE.md - START_SCRIPTS_GUIDE.md - PORTS_GUIDE.md - WHAT_IS_CLAUDE_OS.md **To `/docs/development/` (4 files):** - COMPREHENSIVE_REVIEW.md - SECURITY_FIXES.md - CLAUDE_OS_DEVELOPER_GUIDE.md - PROJECT_SETUP_AND_COMMANDS.md **To `/docs/archive/` (10 files):** - HYBRID_INDEXING_COMPLETE.md - INITIALIZE_PROJECT_HOOKS_FIX.md - INSTALL_ENHANCEMENTS.md - INSTALL_FIXES.md - PISTN_TEST_RESULTS.md - SESSION_SUMMARY.md - TEST_COVERAGE.md - TEST_RESULTS.md - TESTING_STATUS.md - README_TESTING.md ### Updated References: **Fixed broken documentation links in:** - docs/QUICK_REFERENCE.md - docs/PRODUCTION_DEPLOYMENT.md - docs/SCRIPTS_GUIDE.md - docs/development/SECURITY_FIXES.md - docs/guides/BACKUP_RESTORE_GUIDE.md - docs/development/CLAUDE_OS_DEVELOPER_GUIDE.md - tests/TESTING_GUIDE.md - tests/TEST_COVERAGE.md **Script references updated to:** - `./scripts/backup_claude_os.sh` - `./scripts/restore_claude_os.sh` - `./scripts/run_tests.sh` - `./scripts/setup_native.sh` - `./scripts/start_mcp_server.sh` - `./scripts/start_redis_workers.sh` ### Remaining in Root (9 essential files): - install.sh - setup.sh - start.sh - start_all_services.sh - stop_all_services.sh - restart_services.sh - README.md - CLAUDE.md - requirements.txt (+ GEMINI_DIAGRAM_PROMPT.md) ## Benefits: ✅ Cleaner root directory (9 files vs 34 files) ✅ Organized documentation by purpose ✅ Scripts grouped in dedicated directory ✅ Essential startup commands still in root ✅ All references updated and verified ✅ No broken links Version: 2.0.2
142 lines
4.2 KiB
Bash
Executable file
142 lines
4.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Claude OS Test Runner
|
|
# This script runs the test suite with proper environment setup
|
|
|
|
set -e # Exit on error
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${GREEN}================================${NC}"
|
|
echo -e "${GREEN}Claude OS Test Suite${NC}"
|
|
echo -e "${GREEN}================================${NC}"
|
|
echo ""
|
|
|
|
# Check if pytest is installed
|
|
if ! command -v pytest &> /dev/null; then
|
|
echo -e "${RED}❌ pytest not found${NC}"
|
|
echo "Installing test dependencies..."
|
|
pip install pytest pytest-asyncio pytest-cov pytest-mock httpx faker
|
|
fi
|
|
|
|
# Check if PostgreSQL is running
|
|
if ! pg_isready -q; then
|
|
echo -e "${YELLOW}⚠️ PostgreSQL is not running${NC}"
|
|
echo "Please start PostgreSQL before running tests"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if test database exists
|
|
if ! psql -lqt | cut -d \| -f 1 | grep -qw codeforge_test; then
|
|
echo -e "${YELLOW}⚠️ Test database 'codeforge_test' does not exist${NC}"
|
|
echo "Creating test database..."
|
|
createdb codeforge_test
|
|
psql -d codeforge_test -c "CREATE EXTENSION IF NOT EXISTS vector"
|
|
echo -e "${GREEN}✅ Test database created${NC}"
|
|
fi
|
|
|
|
# Set test environment variables
|
|
export TEST_POSTGRES_HOST=${TEST_POSTGRES_HOST:-localhost}
|
|
export TEST_POSTGRES_PORT=${TEST_POSTGRES_PORT:-5432}
|
|
export TEST_POSTGRES_DB=${TEST_POSTGRES_DB:-codeforge_test}
|
|
export TEST_POSTGRES_USER=${TEST_POSTGRES_USER:-$USER}
|
|
export TEST_OLLAMA_HOST=${TEST_OLLAMA_HOST:-http://localhost:11434}
|
|
|
|
echo -e "${GREEN}Test Configuration:${NC}"
|
|
echo " Database: $TEST_POSTGRES_DB"
|
|
echo " Host: $TEST_POSTGRES_HOST:$TEST_POSTGRES_PORT"
|
|
echo " User: $TEST_POSTGRES_USER"
|
|
echo " Ollama: $TEST_OLLAMA_HOST"
|
|
echo ""
|
|
|
|
# Parse command line arguments
|
|
TEST_ARGS=""
|
|
COVERAGE=false
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--unit)
|
|
TEST_ARGS="$TEST_ARGS -m unit"
|
|
shift
|
|
;;
|
|
--integration)
|
|
TEST_ARGS="$TEST_ARGS -m integration"
|
|
shift
|
|
;;
|
|
--vector)
|
|
TEST_ARGS="$TEST_ARGS -m vector"
|
|
shift
|
|
;;
|
|
--rag)
|
|
TEST_ARGS="$TEST_ARGS -m rag"
|
|
shift
|
|
;;
|
|
--api)
|
|
TEST_ARGS="$TEST_ARGS -m api"
|
|
shift
|
|
;;
|
|
--coverage)
|
|
COVERAGE=true
|
|
shift
|
|
;;
|
|
--verbose|-v)
|
|
TEST_ARGS="$TEST_ARGS -v"
|
|
shift
|
|
;;
|
|
--help|-h)
|
|
echo "Usage: ./run_tests.sh [OPTIONS]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " --unit Run only unit tests"
|
|
echo " --integration Run only integration tests"
|
|
echo " --vector Run only vector operation tests"
|
|
echo " --rag Run only RAG engine tests"
|
|
echo " --api Run only API endpoint tests"
|
|
echo " --coverage Generate coverage report"
|
|
echo " --verbose, -v Verbose output"
|
|
echo " --help, -h Show this help message"
|
|
echo ""
|
|
echo "Examples:"
|
|
echo " ./run_tests.sh # Run all tests"
|
|
echo " ./run_tests.sh --unit # Run only unit tests"
|
|
echo " ./run_tests.sh --coverage # Run with coverage"
|
|
echo " ./run_tests.sh --integration -v # Run integration tests verbosely"
|
|
exit 0
|
|
;;
|
|
*)
|
|
TEST_ARGS="$TEST_ARGS $1"
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Run tests
|
|
echo -e "${GREEN}Running tests...${NC}"
|
|
echo ""
|
|
|
|
if [ "$COVERAGE" = true ]; then
|
|
pytest $TEST_ARGS --cov=app --cov-report=term-missing --cov-report=html
|
|
echo ""
|
|
echo -e "${GREEN}✅ Coverage report generated: htmlcov/index.html${NC}"
|
|
else
|
|
pytest $TEST_ARGS
|
|
fi
|
|
|
|
# Check exit code
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo -e "${GREEN}================================${NC}"
|
|
echo -e "${GREEN}✅ All tests passed!${NC}"
|
|
echo -e "${GREEN}================================${NC}"
|
|
else
|
|
echo ""
|
|
echo -e "${RED}================================${NC}"
|
|
echo -e "${RED}❌ Some tests failed${NC}"
|
|
echo -e "${RED}================================${NC}"
|
|
exit 1
|
|
fi
|
|
|