#!/bin/bash # LangMem Test Runner Script set -e echo "๐Ÿงช Running LangMem API Tests" # Check if services are running if ! curl -s http://localhost:8765/health > /dev/null; then echo "โŒ LangMem API is not running. Please start with ./start-dev.sh first." exit 1 fi # Install test dependencies echo "๐Ÿ“ฆ Installing test dependencies..." pip install -r tests/requirements.txt # Run different test suites based on argument case "${1:-all}" in "unit") echo "๐Ÿ”ฌ Running unit tests..." python -m pytest tests/test_api.py -v -m "not integration" ;; "integration") echo "๐Ÿ”— Running integration tests..." python -m pytest tests/test_integration.py -v -m "integration" ;; "all") echo "๐ŸŽฏ Running all tests..." python -m pytest tests/ -v ;; "quick") echo "โšก Running quick tests..." python -m pytest tests/ -v -m "not slow" ;; "coverage") echo "๐Ÿ“Š Running tests with coverage..." python -m pytest tests/ -v --cov=src --cov-report=html --cov-report=term ;; *) echo "โŒ Unknown test type: $1" echo "Usage: ./test.sh [unit|integration|all|quick|coverage]" exit 1 ;; esac echo "" echo "โœ… Tests completed!" # Show service logs if tests failed if [ $? -ne 0 ]; then echo "" echo "โŒ Tests failed. Showing recent API logs:" docker-compose logs --tail=50 langmem-api fi