feat: add comprehensive performance benchmark tracking system

- Create benchmark test suites for critical operations:
  - Node loading performance
  - Database query performance
  - Search operations performance
  - Validation performance
  - MCP tool execution performance

- Add GitHub Actions workflow for benchmark tracking:
  - Runs on push to main and PRs
  - Uses github-action-benchmark for historical tracking
  - Comments on PRs with performance results
  - Alerts on >10% performance regressions
  - Stores results in GitHub Pages

- Create benchmark infrastructure:
  - Custom Vitest benchmark configuration
  - JSON reporter for CI results
  - Result formatter for github-action-benchmark
  - Performance threshold documentation

- Add supporting utilities:
  - SQLiteStorageService for benchmark database setup
  - MCPEngine wrapper for testing MCP tools
  - Test factories for generating benchmark data
  - Enhanced NodeRepository with benchmark methods

- Document benchmark system:
  - Comprehensive benchmark guide in docs/BENCHMARKS.md
  - Performance thresholds in .github/BENCHMARK_THRESHOLDS.md
  - README for benchmarks directory
  - Integration with existing test suite

The benchmark system will help monitor performance over time and catch regressions before they reach production.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-07-28 22:45:09 +02:00
parent 0252788dd6
commit b5210e5963
52 changed files with 6843 additions and 16 deletions

97
.env.test.example Normal file
View File

@@ -0,0 +1,97 @@
# Example Test Environment Configuration
# Copy this file to .env.test and adjust values as needed
# For sensitive values, create .env.test.local (not committed to git)
# === Test Mode Configuration ===
NODE_ENV=test
MCP_MODE=test
TEST_ENVIRONMENT=true
# === Database Configuration ===
# Use :memory: for in-memory SQLite or provide a file path
NODE_DB_PATH=:memory:
REBUILD_ON_START=false
TEST_SEED_DATABASE=true
TEST_SEED_TEMPLATES=true
# === API Configuration ===
# Mock API endpoints for testing
N8N_API_URL=http://localhost:3001/mock-api
N8N_API_KEY=your-test-api-key
N8N_WEBHOOK_BASE_URL=http://localhost:3001/webhook
N8N_WEBHOOK_TEST_URL=http://localhost:3001/webhook-test
# === Test Server Configuration ===
PORT=3001
HOST=127.0.0.1
CORS_ORIGIN=http://localhost:3000,http://localhost:5678
# === Authentication ===
AUTH_TOKEN=test-auth-token
MCP_AUTH_TOKEN=test-mcp-auth-token
# === Logging Configuration ===
LOG_LEVEL=error
DEBUG=false
TEST_LOG_VERBOSE=false
ERROR_SHOW_STACK=true
ERROR_SHOW_DETAILS=true
# === Test Execution Configuration ===
TEST_TIMEOUT_UNIT=5000
TEST_TIMEOUT_INTEGRATION=15000
TEST_TIMEOUT_E2E=30000
TEST_TIMEOUT_GLOBAL=60000
TEST_RETRY_ATTEMPTS=2
TEST_RETRY_DELAY=1000
TEST_PARALLEL=true
TEST_MAX_WORKERS=4
# === Feature Flags ===
FEATURE_TEST_COVERAGE=true
FEATURE_TEST_SCREENSHOTS=false
FEATURE_TEST_VIDEOS=false
FEATURE_TEST_TRACE=false
FEATURE_MOCK_EXTERNAL_APIS=true
FEATURE_USE_TEST_CONTAINERS=false
# === Mock Service Configuration ===
MSW_ENABLED=true
MSW_API_DELAY=0
REDIS_MOCK_ENABLED=true
REDIS_MOCK_PORT=6380
ELASTICSEARCH_MOCK_ENABLED=false
ELASTICSEARCH_MOCK_PORT=9201
# === Test Data Paths ===
TEST_FIXTURES_PATH=./tests/fixtures
TEST_DATA_PATH=./tests/data
TEST_SNAPSHOTS_PATH=./tests/__snapshots__
# === Performance Testing ===
PERF_THRESHOLD_API_RESPONSE=100
PERF_THRESHOLD_DB_QUERY=50
PERF_THRESHOLD_NODE_PARSE=200
# === Rate Limiting ===
RATE_LIMIT_MAX=0
RATE_LIMIT_WINDOW=0
# === Cache Configuration ===
CACHE_TTL=0
CACHE_ENABLED=false
# === Cleanup Configuration ===
TEST_CLEANUP_ENABLED=true
TEST_CLEANUP_ON_FAILURE=false
# === Network Configuration ===
NETWORK_TIMEOUT=5000
NETWORK_RETRY_COUNT=0
# === Memory Limits ===
TEST_MEMORY_LIMIT=512
# === Code Coverage ===
COVERAGE_DIR=./coverage
COVERAGE_REPORTER=lcov,html,text-summary