#!/bin/bash
# Quick test commands reference

echo "╔════════════════════════════════════════════════════════════════╗"
echo "║                    TEST SUITE QUICK START                      ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""

# Check Ollama
if curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then
    echo "[OK] Ollama detected - Full test suite available"
else
    echo "⚠️  Ollama not running - LLM tests will be skipped"
    echo "   Start with: ollama serve"
    echo "   Install from: https://ollama.com"
fi

echo ""
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║                      QUICK COMMANDS                            ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
echo "🚀 RECOMMENDED (smart auto-detect):"
echo "   python run_tests.py"
echo ""
echo "⚡ FAST (unit tests only, <10s):"
echo "   python run_tests.py --fast"
echo "   pytest tests/ -v -k 'not llm_client'"
echo ""
echo "📊 WITH COVERAGE:"
echo "   python run_tests.py --coverage"
echo "   pytest tests/ --cov=rag --cov=database --cov-report=term-missing"
echo ""
echo "🎯 SPECIFIC FILE:"
echo "   python run_tests.py --file retriever"
echo "   pytest tests/test_retriever.py -v"
echo ""
echo "🔬 SINGLE TEST:"
echo "   pytest tests/test_retriever.py::test_severity_ranking -v"
echo ""
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║                      TEST FILES                                ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
echo "tests/"
echo "├── test_knowledge_graph.py    (1 test, <1s)"
echo "├── test_cwe_enrichment.py     (1 test, <1s)"
echo "├── test_normalizer.py          (5 tests, ~2s)"
echo "├── test_retriever.py           (8 tests, ~5s) [NEW]"
echo "├── test_llm_client.py          (9 tests, ~30s, requires Ollama) [NEW]"
echo "└── test_end_to_end.py          (2 tests, ~3s)"
echo ""
echo "Total: 26 tests (~40s with Ollama)"
echo ""
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║                    TROUBLESHOOTING                             ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
echo "[FAIL] Import errors:"
echo "   export PYTHONPATH=\$PWD:\$PYTHONPATH"
echo ""
echo "[FAIL] Ollama connection refused:"
echo "   ollama serve  # Run in separate terminal"
echo "   pytest tests/ -v -k 'not llm_client'  # Skip LLM tests"
echo ""
echo "[FAIL] Tests timeout:"
echo "   pytest tests/ -v --timeout=300"
echo ""
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║                      CI/CD USAGE                               ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
echo "# GitHub Actions / Jenkins"
echo "pytest tests/ -v -x -k 'not llm_client' --junitxml=test-results.xml"
echo ""
echo "# Pre-commit hook"
echo "pytest tests/ -v --tb=short -k 'not llm_client'"
echo ""
