c889a57b6b
Test Suites / Build CI Environment (push) Has been cancelled
Test Suites / Basic Tests (push) Has been cancelled
Test Suites / End-to-End Tests (push) Has been cancelled
Test Suites / CLI Tests (push) Has been cancelled
Test Suites / Slow End-to-End Tests (push) Has been cancelled
Test Suites / Graph Database Tests (push) Has been cancelled
Test Suites / Vector DB Tests (push) Has been cancelled
Test Suites / Temporal Graph Test (push) Has been cancelled
Test Suites / Search Test on Different DBs (push) Has been cancelled
Test Suites / Example Tests (push) Has been cancelled
Test Suites / Notebook Tests (push) Has been cancelled
Test Suites / OS and Python Tests Ubuntu (push) Has been cancelled
Test Suites / OS and Python Tests Extended (push) Has been cancelled
Test Suites / LLM Test Suite (push) Has been cancelled
Test Suites / S3 File Storage Test (push) Has been cancelled
Test Suites / Run Integration Tests (push) Has been cancelled
Test Suites / MCP Tests (push) Has been cancelled
Test Suites / Docker Compose Test (push) Has been cancelled
Test Suites / Docker CI test (push) Has been cancelled
Test Suites / Relational DB Migration Tests (push) Has been cancelled
Test Suites / Distributed Cognee Test (push) Has been cancelled
Test Suites / DB Examples Tests (push) Has been cancelled
Test Suites / Test Completion Status (push) Has been cancelled
Test Suites / Claude Code Review (push) Has been cancelled
Test Suites / basic checks (push) Has been cancelled
build | Build and Push Cognee MCP Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
build | Build and Push Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.11) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.12) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (kuzu, kuzu) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (neo4j, neo4j) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Examples (push) Has been cancelled
Weighted Edges Tests / Code Quality for Weighted Edges (push) Has been cancelled
66 lines
1.8 KiB
Python
66 lines
1.8 KiB
Python
"""
|
|
Pytest wrapper for the performance analysis benchmark.
|
|
|
|
Runs statistics_percentile_report.py with mock LLM and validates:
|
|
- JSON and HTML report files are generated
|
|
- All benchmark runs completed without failures
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REPORT_SCRIPT = Path(__file__).parent / "performance" / "statistics_percentile_report.py"
|
|
COGNEE_ROOT = Path(__file__).resolve().parents[3]
|
|
RESULTS_DIR = Path(__file__).parent / ".data_storage" / "test_performance_analysis"
|
|
|
|
|
|
def test_performance_analysis():
|
|
RESULTS_DIR.mkdir(parents=True, exist_ok=True)
|
|
json_path = RESULTS_DIR / "report.json"
|
|
html_path = RESULTS_DIR / "report.html"
|
|
|
|
result = subprocess.run(
|
|
[
|
|
sys.executable,
|
|
str(REPORT_SCRIPT),
|
|
"--runs",
|
|
"5",
|
|
"--output",
|
|
str(json_path),
|
|
"--html",
|
|
str(html_path),
|
|
"--mock-llm",
|
|
"--num-memories",
|
|
"20",
|
|
],
|
|
cwd=str(COGNEE_ROOT),
|
|
text=True,
|
|
capture_output=True,
|
|
timeout=600,
|
|
)
|
|
|
|
assert result.returncode == 0, (
|
|
f"Performance report script failed (exit code {result.returncode})\n"
|
|
f"stdout:\n{result.stdout}\nstderr:\n{result.stderr}"
|
|
)
|
|
|
|
assert json_path.exists(), "JSON report was not generated"
|
|
assert html_path.exists(), "HTML report was not generated"
|
|
|
|
with open(json_path) as f:
|
|
report = json.load(f)
|
|
|
|
assert report["failed"] == 0, f"{report['failed']}/{report['num_runs']} runs failed"
|
|
|
|
for i, run in enumerate(report["raw_runs"], 1):
|
|
assert run.get("success") is True, f"Run {i} failed: {run.get('status', {})}"
|
|
|
|
print(f"\nJSON report: {json_path}")
|
|
print(f"HTML report: {html_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_performance_analysis()
|